25 lines
		
	
	
		
			631 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			631 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
const express = require('express');
 | 
						|
const Thermal = require('./modules/Thermal.js');
 | 
						|
const printer = require('printer');
 | 
						|
 | 
						|
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');
 | 
						|
  } 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}`);
 | 
						|
});
 |