-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
23 lines (19 loc) · 680 Bytes
/
app.js
File metadata and controls
23 lines (19 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import express from 'express';
import { join } from 'path';
import dotenv from "dotenv"
import connectDB from './config/db.js';
import queryRoutes from './routes/queryRoutes.js';
import path from 'path';
import { fileURLToPath } from 'url';
dotenv.config();
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
connectDB();
const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(express.static(join(__dirname, 'public')));
app.use(express.json());
app.set('view engine', 'ejs');
app.use('/', queryRoutes);
app.listen(process.env.PORT || 3000, () => console.log(`
Server running on http://localhost:3000`));