-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (27 loc) · 866 Bytes
/
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
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json())
var data = [];
app.post('/webhook', async function (req, res) {
console.log(req.body);
data.push(req.body);
res.send({ ack: "true", currentTime: new Date().toISOString() });
});
app.get('/webhook/check', async function (req, res) {
res.send(data);
});
app.get('/webhook/clear', async function (req, res) {
data = [];
res.send(data);
});
app.post('/webhook2', async function (req, res) {
console.log(req.body);
res.send({ ack: "true", currentTime: new Date(date).getTime().toString() });
});
function getTime(date) {
return new Date(date).getTime().toString();
}
var server = app.listen(3000, function () { });
console.log('Server is Started !!!')