-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (23 loc) · 740 Bytes
/
Copy pathindex.js
File metadata and controls
34 lines (23 loc) · 740 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
33
34
const path = require("path");
const express = require("express");
const bodyParser = require("body-parser");
// imported routes
// const authRoutes = require("./routes/auth");
const userRoutes = require("./routes/users");
// intialize app
const app = express();
// middlewares
app.use('/users', userRoutes);
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
//setting the view engine
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "ejs");
// routes
// parse application/json
//app.use(bodyParser.json())
const PORT = process.env.PORT || 3000;
app.listen(PORT, () =>
console.log(`Server running on http://localhost:${PORT}`)
);