const mqtt = require('mqtt');
const express = require('express');
const path = require('path');
const app = express();
const port = 3001;

app.post('public/index.html')
// Serve static files from the template's public folder
app.use(express.static(path.join(__dirname, 'public')));
// app.use(express.static(__dirname));

// Route to serve the main dashboard HTML file
app.get('/', (req, res) => {
    res.sendFile(path.join(__dirname, 'public/index.html'));
});

// Example API endpoint for dashboard data
app.get('/api/data', (req, res) => {
    res.json({
        users: 150,
        sales: 2500,
        revenue: 50000,
        active_sessions: 45
    });
});

// Start the server
app.listen(port, () => {
    console.log(`Server running at http://localhost:${port}`);
});