-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
49 lines (35 loc) · 1.37 KB
/
app.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
42
43
44
45
46
47
48
49
var express = require("express");
var bodyParser = require("body-parser");
var mongoose = require("mongoose");
var passport = require("passport");
var LocalStrategy = require('passport-local').Strategy;
var session = require('express-session');
var passport = require('passport');
var io = require('socket.io')(http);
var userControllers = require("./api/controller/userController");
var bussinessController = require("./api/controller/bussinessController");
var socketController= require("./api/controller/socketController")
const config = require('./api/config/database');
var app = express();
var port = process.env.PORT || 3000;
var http = require('http').createServer(app);
var io = require('socket.io').listen(http);
app.use(express.static(__dirname + "/"));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(session({ secret: "mysecret" }))
app.use(passport.initialize())
app.use(passport.session())
app.use(passport.initialize());
app.use(passport.session());
var Users = require('./api/model/user')
app.set("view engine", "ejs");
mongoose.connect(config.database);
//mongoose.connect('mongodb://localhost/SupperShip');
userControllers(app, passport);
bussinessController(app,passport, io);
socketController(io);
http.listen(port, function () {
console.log("Server is connecting in port: " + port);
//console.log(parseInt('20', 10) - 5);
})