plugin2: counter
This commit is contained in:
parent
98f962c583
commit
c49cd95a98
2 changed files with 19 additions and 0 deletions
1
index.js
1
index.js
|
@ -7,6 +7,7 @@ app.use(express.json());
|
||||||
|
|
||||||
// connect the plugin(s)
|
// connect the plugin(s)
|
||||||
app.use('/plugin', require('./plugin'))
|
app.use('/plugin', require('./plugin'))
|
||||||
|
app.use('/plugin2', require('./plugin2'))
|
||||||
|
|
||||||
// catch 404 and forward to error handler
|
// catch 404 and forward to error handler
|
||||||
const createError = require('http-errors')
|
const createError = require('http-errors')
|
||||||
|
|
18
plugin2/index.js
Normal file
18
plugin2/index.js
Normal 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
|
||||||
|
|
Loading…
Add table
Reference in a new issue