-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
25 lines (21 loc) · 718 Bytes
/
server.js
File metadata and controls
25 lines (21 loc) · 718 Bytes
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
const express = require('express');
const bodyParser = require('body-parser');
const request = require('request');
const verification = require('./verification');
const webhook = require('./webhook');
module.exports = function server_exports_function(
loopsController,
port = 3000) {
function passLoopsControllerToWebhook(req, res, next) {
req.loopsController = loopsController;
next();
}
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.listen(port, function() {
console.log('Running on port %i', port);
});
app.get('/', verification);
app.post('/', passLoopsControllerToWebhook, webhook);
}