24 lines
605 B
JavaScript
24 lines
605 B
JavaScript
const express = require('express');
|
|
const Thermal = require('./modules/Thermal.js');
|
|
|
|
const app = express();
|
|
const port = 3000;
|
|
|
|
// Middleware to serve static files (HTML)
|
|
app.use(express.static('public'));
|
|
|
|
// Test print function
|
|
app.post('/test-print', async (req, res) => {
|
|
try {
|
|
Thermal.generateFile('Grant.Aiden2', '5012345', req, res);
|
|
} catch (error) {
|
|
console.error('Print Error:', error);
|
|
res.status(500).json({ message: 'Print Error', error: error.message });
|
|
}
|
|
});
|
|
|
|
// Start the server
|
|
app.listen(port, () => {
|
|
console.log(`Server running at http://localhost:${port}`);
|
|
});
|