implement webhook

This commit is contained in:
LouisLam 2021-07-09 19:33:22 +08:00
parent d24a15410e
commit 0ad04d1468
6 changed files with 126 additions and 47 deletions

View file

@ -12,6 +12,8 @@ const Monitor = require("./model/monitor");
const {getSettings} = require("./util-server");
const {Notification} = require("./notification")
app.use(express.json())
let totalClient = 0;
let jwtSecret = null;
let monitorList = {};
@ -27,6 +29,13 @@ let monitorList = {};
app.use('/', express.static("dist"));
app.post('/test-webhook', function(request, response, next) {
console.log("Test Webhook (application/json only)")
console.log("Content-Type: " + request.header("Content-Type"))
console.log(request.body)
response.end();
});
app.get('*', function(request, response, next) {
response.sendFile(process.cwd() + '/dist/index.html');
});