22 lines
570 B
JavaScript
22 lines
570 B
JavaScript
// Import required modules
|
|
const express = require('express');
|
|
const path = require('path');
|
|
|
|
// Create an Express application
|
|
const app = express();
|
|
|
|
// Serve static files from the 'src' directory
|
|
app.use(express.static(path.join(__dirname, 'src')));
|
|
|
|
// Define a route to serve the HTML file
|
|
app.get('/', (req, res) => {
|
|
// Send the HTML file as the response
|
|
res.sendFile(path.join(__dirname, 'src/index.html'));
|
|
});
|
|
|
|
// Start the server
|
|
const PORT = process.env.PORT || 3000;
|
|
app.listen(PORT, () => {
|
|
console.log(`Server is running on port ${PORT}`);
|
|
});
|