2024-09-06 23:26:30 +00:00
|
|
|
const express = require('express');
|
2024-09-09 15:38:53 +00:00
|
|
|
const Thermal = require('./modules/Thermal.js');
|
2024-09-06 23:26:30 +00:00
|
|
|
|
|
|
|
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 {
|
2024-09-09 17:05:03 +00:00
|
|
|
Thermal.generateFile('Grant.Aiden2', '5012345', req, res);
|
2024-09-06 23:26:30 +00:00
|
|
|
} 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}`);
|
|
|
|
});
|