2024-10-12 19:18:53 -04:00
|
|
|
const express = require('express');
|
|
|
|
const path = require('path');
|
2024-10-15 16:35:07 -04:00
|
|
|
const fs = require('fs');
|
2024-10-15 19:33:03 -04:00
|
|
|
|
2024-10-12 19:18:53 -04:00
|
|
|
const app = express();
|
|
|
|
app.set('view engine', 'ejs');
|
|
|
|
app.set('views', path.join(__dirname, 'views'));
|
|
|
|
app.use(express.static(path.join(__dirname, 'public')));
|
2024-10-15 16:35:07 -04:00
|
|
|
app.use(express.json());
|
2024-10-12 19:18:53 -04:00
|
|
|
|
2024-10-21 20:35:21 -04:00
|
|
|
const routes = ['/', '/about', '/contact', '/verify', '/status', '/design', '/projects', '/cloud'];
|
2024-10-15 16:35:07 -04:00
|
|
|
routes.forEach(route => {
|
|
|
|
app.get(route, (req, res) => {
|
|
|
|
res.render(route === '/' ? 'index' : route.slice(1), { req });
|
|
|
|
});
|
2024-10-12 19:18:53 -04:00
|
|
|
});
|
|
|
|
|
2024-10-21 20:25:23 -04:00
|
|
|
const PORT = process.env.PORT || 5566;
|
2024-10-12 19:18:53 -04:00
|
|
|
app.listen(PORT, () => {
|
2024-10-15 16:35:07 -04:00
|
|
|
const now = new Date();
|
|
|
|
const fT = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`;
|
|
|
|
console.log(`Running at: ${fT}`);
|
2024-10-12 19:18:53 -04:00
|
|
|
console.log(`Server running on http://localhost:${PORT}`);
|
2024-10-15 16:35:07 -04:00
|
|
|
});
|