forked from freeCodeCamp/camper-gitter-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
40 lines (32 loc) · 1.04 KB
/
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
33
34
35
36
37
38
39
40
'use strict';
require('dotenv').config({ path: 'dot.env' });
console.log('--------------- startup ------------------');
if (typeof Map !== 'function' ) {
throw new Error('ES6 is required; add --harmony');
}
const express = require('express'),
port = process.env.PORT || 7891,
passport = require('./lib/gitter/passportModule'),
GBot = require('./lib/bot/GBot'),
routes = require('./lib/app/routes.js'),
path = require('path');
const app = express();
// Middlewares
app.set('view engine', 'jade');
app.set('views', path.join(__dirname, '/views'));
app.use(express.json());
app.use(express.urlencoded());
app.use(express.static(path.join(__dirname, '/public')));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({
secret: 'keyboard cat'
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
GBot.init();
routes.init(app, GBot, passport);
app.listen(port);
console.log('Demo app running at http://localhost:' + port);