-
Notifications
You must be signed in to change notification settings - Fork 7
/
app.js
44 lines (39 loc) · 1.33 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
var express = require('express');
var jade = require('jade');
var app = express();
var passport = require('passport');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var bodyParser = require('body-parser');
//Routes
var usersRoute = require('./routes/users');
var publishersRoute = require('./routes/publishers');
var actionTypesRoute = require('./routes/actiontypes');
var userActionsRoute = require('./routes/useractions');
var adRequest = require('./routes/adRequest');
var querystring = require('querystring');
app.use(bodyParser.urlencoded({extended : true}));
app.use(cookieParser());
app.use(session({
secret: process.env.SESSION_SECRET || 'secret',
resave: false,
saveUninitialized: false
}));
app.use(passport.initialize());
app.use(passport.session());
var auth = require('./auth.js');
var morgan = require('morgan');
app.use(auth.initialize());
app.set('views', __dirname + '/views');
app.set('public',__dirname + '/public');
app.set('view engine', 'ejs');
app.use(morgan('dev'));
app.use(express.static(__dirname + '/public'));
app.use('/adRequest',adRequest);
app.use('/users', usersRoute);
app.use('/publishers', publishersRoute);
app.use('/actiontypes', actionTypesRoute);
app.use('/useractions', userActionsRoute);
app.listen(3000);
console.log("Listening on port 3000");
module.exports = app;