-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
26 lines (20 loc) · 793 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
'use strict';
const bodyParser = require('body-parser');
const config = require('config');
const express = require('express');
const https = require('https');
const request = require('request');
const authMiddleware = require('./src/authMiddleware');
const webhook = require('./src/webhook');
const verifyRequestSignature = require('./src/verifyRequestSignature');
const app = express();
app.set('port', config.get('port'));
app.set('view engine', 'ejs');
app.use(bodyParser.json({ verify: verifyRequestSignature }));
app.get('/webhook', webhook.validationMiddleware);
app.post('/webhook', webhook.commonMiddleware);
app.get('/authorize', authMiddleware);
app.listen(app.get('port'), function () {
console.log('Node app is running on port', app.get('port'));
});
module.exports = app;