-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathapp.js
37 lines (25 loc) · 863 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
33
34
35
36
'use strict';
const debug = require('debug')('cbp:app');
const express = require('express');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
debug('loading configuration');
const config = require('./config');
require('./init')(config);
const app = express();
app.enable('trust proxy');
app.set('port', process.env.PORT || 3000);
if (app.get('env') !== 'testing') {
app.use(logger('dev'));
}
app.use(bodyParser.json({limit: '10mb'}));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
//Bot routes
const botRoutes = require('./routes');
app.get('/bot', botRoutes.get);
app.post('/bot', botRoutes.receive);
const server = app.listen(app.get('port'), function () {
console.log('express server listening on port ' + server.address().port);
});