-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (21 loc) · 714 Bytes
/
index.js
File metadata and controls
33 lines (21 loc) · 714 Bytes
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
29
30
31
32
import express from "express";
import 'dotenv/config';
import path from "node:path"
import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
import pokRouter from "./routes/pok.router.js";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(express.static('public'));
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "ejs");
app.use('/', pokRouter);
app.use((err, req, res, next) => {
res.render('w', { errors: err })
})
app.listen(3000, (error) => {
console.log(`Started at http://localhost:3000`)
})