I am using "connect": "^3.3.5"
, I have app.use '/', messageMiddleware.incoming, userMiddleware.process
My messageMiddleware
has:
exports.incoming = (req, res, next) ->
fromNumber = req.body.From
toNumber = req.body.To
global.db.Message.create
message: req.body.Body.trim()
from: fromNumber
to: toNumber
.then (dbMessage) ->
req.MessageId = dbMessage.id
next()
.catch (err) ->
next err
My userMiddleware
has
'use strict'
exports.process = (req, res, next) ->
console.log 'processing'
res.end()
However, it doesn't log processing
or end
. What am I doing incorrectly?
Instead of
exports.incoming
, trymodule.exports = {incoming: (req, res, next) ->...}