29 lines
751 B
JavaScript
29 lines
751 B
JavaScript
|
const express = require('express');
|
||
|
const path = require('path');
|
||
|
const app = express();
|
||
|
const port = process.env.PORT || 3000;
|
||
|
|
||
|
// Serve static files from public directory
|
||
|
app.use(express.static('public'));
|
||
|
|
||
|
// Basic routes
|
||
|
app.get('/', (req, res) => {
|
||
|
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
||
|
});
|
||
|
|
||
|
app.get('/about', (req, res) => {
|
||
|
res.sendFile(path.join(__dirname, 'public', 'about.html'));
|
||
|
});
|
||
|
|
||
|
app.get('/contact', (req, res) => {
|
||
|
res.sendFile(path.join(__dirname, 'public', 'contact.html'));
|
||
|
});
|
||
|
|
||
|
// Health check for the container
|
||
|
app.get('/ping', (req, res) => {
|
||
|
res.json({ status: 'ok', timestamp: new Date().toISOString() });
|
||
|
});
|
||
|
|
||
|
app.listen(port, () => {
|
||
|
console.log(`Simple website running on port ${port}`);
|
||
|
});
|