-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (26 loc) · 848 Bytes
/
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
const express = require('express');
const passport = require('passport');
const monogoose = require('mongoose');
const bodyParser = require('body-parser');
const cookieSession = require('cookie-session');
const fileUpload = require('express-fileupload');
const keys = require('./config/keys');
require('./models/User');
require('./models/Post');
require('./services/passport');
monogoose.connect(keys.mongoURI);
const app = express();
app.use(bodyParser.json());
app.use(
cookieSession({
maxAge: 30 * 24 * 60 * 60 * 1000,
keys: [keys.cookieKey]
})
);
app.use(passport.initialize());
app.use(passport.session());
app.use(fileUpload());
require('./routes/authRoutes')(app);
require('./routes/userRoutes')(app);
require('./routes/postRoutes')(app);
app.listen(5000, () => console.log("example listening on port 5000"))