plugin2: counter

This commit is contained in:
Daniel Brahneborg 2019-08-21 07:33:14 +02:00
parent 98f962c583
commit c49cd95a98
2 changed files with 19 additions and 0 deletions

View file

@ -7,6 +7,7 @@ app.use(express.json());
// connect the plugin(s)
app.use('/plugin', require('./plugin'))
app.use('/plugin2', require('./plugin2'))
// catch 404 and forward to error handler
const createError = require('http-errors')

18
plugin2/index.js Normal file
View file

@ -0,0 +1,18 @@
const express = require('express')
const router = express.Router()
var counter = 0;
router.post('/before_receive', (req, res) => {
const qe = req.body.qe
counter = counter + 1
res.send('qe.MESSAGE=Message ' + counter + ': ' + qe.MESSAGE)
})
router.use((req, res, next) => {
res.status(404).end()
})
module.exports = router