2024-11-14 13:53:04 +00:00
|
|
|
import express from 'express';
|
|
|
|
import dotenv from 'dotenv';
|
|
|
|
import path from 'path'; // Import the path module
|
|
|
|
import routes from './src/routes.js'; // Import routes from routes.js
|
2024-11-18 15:55:34 +00:00
|
|
|
import { validateEnvVariables } from './src/envValidator.js';
|
2024-11-14 13:53:04 +00:00
|
|
|
|
|
|
|
dotenv.config();
|
|
|
|
|
2024-11-18 15:55:34 +00:00
|
|
|
validateEnvVariables();
|
|
|
|
|
2024-11-14 13:53:04 +00:00
|
|
|
const app = express();
|
|
|
|
const PORT = process.env.PORT || 3002;
|
|
|
|
|
|
|
|
app.use(express.json());
|
|
|
|
|
|
|
|
app.use(express.static(path.join(process.cwd(), 'public')));
|
|
|
|
|
|
|
|
app.use('/', routes);
|
|
|
|
|
|
|
|
app.listen(PORT, () => {
|
|
|
|
console.log(`Server is running on http://localhost:${PORT}`);
|
|
|
|
});
|