-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
42 lines (34 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
41
42
var express = require('express');
var app = express();
var port = process.env.PORT || 8080;
var mongoose = require('mongoose');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var MongoStore = require('connect-mongo')(session);
var multer = require('multer')
var upload = multer()
//var passport = require('passport');
//require('./config/passport')(passport);
var morgan = require('morgan');
var configDB = require('./config/database.js');
mongoose.connect(configDB.url);
app.use(morgan('dev'));
app.use(cookieParser());
//app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
//app.set('view engine', 'ejs'); // starting ejs
var pic = require('./app/models/pic.js');
//Passport Setup
app.use(session({secret: 'inclean@Hack\'15',
store:new MongoStore({
url: configDB.sessdb
}),
resave: true,
saveUninitialized: true
})); // session init
//app.use(passport.initialize());
//app.use(passport.session());
require('./app/routes.js')(app,express,upload); // loading routes
app.listen(port);
console.log("Switch to port " + port +" for some magic.");