What is the correct way to “end” a request from express/connect middleware?
问题 Assuming I have middleware such as this; var express = require('express'); var app = express(); app.use(function (req, res, next) { var host = "example.com"; if (req.host !== host) { res.redirect(301, host + req.originalUrl); res.end(); } }); What sort of rules do I need to abide by here? Should I be calling res.end() ? (or does res.redirect() do this for me?) Should I be calling next() ? (or does connect detect the request has ended and exit cleanly?) Assuming that I should be calling next()