为什么我的连接中间件不转发?

Why doesn't my connect middleware pass forward?

我正在使用 "connect": "^3.3.5",我有 app.use '/', messageMiddleware.incoming, userMiddleware.process

我的 messageMiddleware 有:

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

我的userMiddleware

'use strict'

exports.process = (req, res, next) ->
  console.log 'processing'
  res.end()

但是,它不会记录 processingend。我做错了什么?

而不是 exports.incoming,试试 module.exports = {incoming: (req, res, next) ->...}