-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
38 lines (30 loc) · 955 Bytes
/
main.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
const mongoose = require("mongoose"),
express = require("express"),
app = express(),
router = require("./routes/index"),
layouts = require("express-ejs-layouts"),
methodOverride = require("method-override"),
passport = require("passport"),
expressSession = require("express-session"),
cookieParser = require("cookie-parser"),
connectFlash = require("connect-flash");
mongoose.Promise = global.Promise;
mongoose.connect(
process.env.MONGODB_URI || "mongodb://localhost:27017/docucare",
{useNewUrlParser: true}
);
app.set("port", process.env.PORT || 3000);
app.set("view engine", "ejs");
app.use(layouts);
app.use(express.static("public"));
app.use(
express.urlencoded({
extended: false
})
);
app.use(express.json());
app.use(methodOverride("_method", {methods: ["POST", "GET"]}));
app.use("/", router);
app.listen(app.get("port"), () => {
console.log(`Server running at http://localhost:${app.get("port")}`);
});