-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
40 lines (35 loc) · 1.15 KB
/
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
31
32
33
34
35
36
37
38
39
40
const express = require('express');
const mongoose = require('mongoose');
const cookieSession = require('cookie-session');
const passport = require('passport');
const bodyParser = require('body-parser');
const keys = require('./config/keys');
require('./models/providerMapData');
require('./models/refCollection');
require('./models/users');
require('./models/devices');
// require('./services/passport');
mongoose.connect(keys.MONGODB_URI, {useNewUrlParser: true});
const app = express();
app.use(bodyParser.json());
// For Authentication use, if online application is needed:
app.use(
cookieSession({
maxAge: 30 * 24 * 60 * 60 * 1000,
keys: [keys.cookieKey]
})
);
app.use(passport.initialize());
app.use(passport.session());
require('./routes/mainRoutes')(app);
require('./routes/appDeviceRoutes')(app);
require('./routes/appUserRoutes')(app);
require('./routes/webAuthUserRoutes')(app);
// require('./routes/providerRoutes')(app); DEPRECATED
require('./routes/providerRoutes2')(app);
// require('./routes/rcRoutes')(app);
app.listen(keys.PORT, () => {
if (process.env.NODE_ENV !== 'production') {
console.log(`listening on port ${keys.PORT}`);
}
})