-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
28 lines (22 loc) · 855 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// app.js
import express from 'express';
import dotenv from 'dotenv/config';
import manageRoutes from './routes/manageRoutes.js';
import webRoutes from './routes/webRoutes.js';
import apiRoutes from './routes/apiRoutes.js';
import bodyParser from 'body-parser';
import path from 'path';
const app = express();
const __dirname = path.resolve(); // If using ES modules
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views')); // <-- Add this line
app.use(express.static('public'));
app.use('/public', express.static(path.join(__dirname, 'public')));
app.use(bodyParser.urlencoded({ extended: true }));
// Use the sitemap routes
// app.use('/', manageRoutes);
app.use('/', webRoutes);
app.use('/api', apiRoutes);
app.listen(process.env.PORT, () => {
console.log(`Server running on http://localhost:${process.env.PORT}`);
});