-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver.js
51 lines (33 loc) · 1.21 KB
/
server.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
45
46
47
48
49
50
51
var express = require('express');
var app = express();
var http = require('http');
var path = require('path');
var fs = require('fs');
var port = process.env.PORT || 9090;
var mongoose = require('mongoose');
var passport = require('passport');
var flash = require('connect-flash');
var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var db = require('./model/db');
var beerModel = require ('./model/beerModel');
//Routes========================================================================
// app.use('/api/users', getUsersRoutes);
require('./config/passport')(passport);
app.use(morgan('dev'));
app.use(cookieParser());
app.use(bodyParser());
// set the view engine to ejs
app.set('view engine', 'ejs');
app.use(express.static('public'));
app.use(session({ secret: 'ilovescotchscotchyscotchscotch' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(flash());
require('./routes/userRoutes.js')(app, passport);
require ('./routes/beerRoutes')(app, passport);
require ('./routes/ratingRoutes')(app, passport);
app.listen(port);
console.log('9090 is the magic port');