-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
32 lines (26 loc) · 918 Bytes
/
server.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
var express = require('express');
var mongoose = require('mongoose');
var passport = require('passport');
var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var Stomp = require('stompjs');
var app = express();
var port = process.argv[2] || 8000;
var database = require('./config/database.js');
mongoose.connect(database.url);
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(session({secret: '651de52f36ae3a7d02a6808928b8b756', resave: true, saveUninitialized: true}));
app.use(passport.initialize());
app.use(passport.session());
require('./app/route.js')(app);
var server = app.listen(port, function(err) {
if(err) throw err;
var host = server.address().address;
console.log("Backend listening at http://%s:%s", host, port);
});