-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (27 loc) · 1004 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
const express = require("express");
const cors = require("cors");
const cookieParser = require("cookie-parser");
const app = express();
const server = require("http").createServer(app);
app.use(cors());
const bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
const path = require("path");
const env = require("./config/environment");
const db = require("./config/mongoose");
const session = require("express-session");
const passport = require("passport");
const passportJWT = require("./config/passport-jwt-strategy");
const chatSocket = require("./config/chat_sockets.js").chatSockets(server);
const port = env.port;
app.use("/uploads", express.static(__dirname + "/uploads"));
app.use(passport.initialize());
//use express router
app.use("/", require("./routes"));
server.listen(port, function (error) {
if (error) {
console.log(`Error in running server: ${error}`);
}
console.log(`Server is running on port:${port}`);
});