-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (31 loc) · 902 Bytes
/
index.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
29
30
31
32
33
34
35
36
37
38
39
40
41
const express = require("express");
const app = express();
const connectDB = require("./config/db");
const router = require("./routers/index");
const errorHandler = require("./errorHandler/index");
const { PORT } = require("./config/constants");
const cors = require("cors");
const bodyParser = require("body-parser");
const morgan = require("morgan");
const port = PORT || 3000;
//dsadsad
app.use(cors());
app.use(morgan("tiny"));
app.use(
require("express-session")({
secret: "SDSDASDASDSAKDLKJLASLKDJLASDJLASJDL",
resave: true,
saveUninitialized: true,
})
);
app.use('/uploads', express.static('uploads'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// app.use(cookieParser());
app.use(express.json());
app.use(router);
connectDB();
app.use(errorHandler);
app.listen(port, () => {
console.log("this app is running on " + port);
});