diff --git a/mccs-it/thermal/app.js b/mccs-it/thermal/app.js index 2c4fa65..433ca81 100644 --- a/mccs-it/thermal/app.js +++ b/mccs-it/thermal/app.js @@ -7,10 +7,17 @@ const port = 3000; // Middleware to serve static files (HTML) app.use(express.static('public')); +// Middleware to parse JSON request bodies +app.use(express.json()); + // Test print function app.post('/test-print', async (req, res) => { try { - Thermal.generateFile('Grant.Aiden2', '5012345', req, res); + const { username, studentId } = req.body; + if (!username || !studentId) { + return res.status(400).json({ message: 'Username and Student ID are required.' }); + } + await Thermal.generateFile(username, studentId, req, res); } catch (error) { console.error('Print Error:', error); res.status(500).json({ message: 'Print Error', error: error.message }); diff --git a/mccs-it/thermal/public/index.html b/mccs-it/thermal/public/index.html index 7948691..82f2452 100644 --- a/mccs-it/thermal/public/index.html +++ b/mccs-it/thermal/public/index.html @@ -3,32 +3,50 @@ - Test Print - + Thermal Printer Test

Thermal Printer Test

- - +
+ +

+ + +

+ + +
- + \ No newline at end of file