-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
32 lines (25 loc) · 919 Bytes
/
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
var express = require('express');
var app = express();
var mongoose = require('mongoose');
var passport = require('passport');
var flash = require('connect-flash');
var hbs = require("hbs");
var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
mongoose.connect('mongodb://localhost/local-authentication-with-passport');
app.use(morgan('dev'));
app.use(cookieParser());
app.use(bodyParser());
app.set('view engine', 'hbs');
app.set("views","./views");
app.use(express.static(__dirname + '/public'));
app.use(session({ secret: 'WDI-GENERAL-ASSEMBLY-EXPRESS' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(flash());
require('./config/passport')(passport);
var routes = require('./config/routes');
app.use(routes);
app.listen(3000);