forked from alihalabyah/traider.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
traider.js
41 lines (30 loc) · 1.04 KB
/
traider.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
var express = require('express'),
cookieParser = require('cookie-parser'),
expressSession = require('express-session');
var routes = require('./routes/routes.js');
var MongoStore = require('connect-mongo')({
session: expressSession
});
createServer = function createServer() {
var server = express();
// specify middleware
//server.use(express.bodyParser());
server.use(express.static(__dirname + '/public'));
server.use('/product/*', express.static(__dirname + '/public'));
server.use('/basket/', express.static(__dirname + '/public'));
server.use(cookieParser());
server.use(expressSession({
secret: 'mdfkldfgkl&*(sas/d,asldsjf()*)(mlksdmfNfjSDsdfYUHNn',
store: new MongoStore({
db: 'traiderioSessions'
})
}));
// attach router handlers
routes.attachHandlers(server); //, passport);
return server;
};
var server = createServer();
var port = Number(process.env.PORT || 5000);
server.listen(port, function() {
console.log("Listening on " + port);
});