在node.jsexpression式中放置请求

是否有可能使用Node.js并表示删除某个路由的请求? IE不返回一个HTTP状态或任何头? 我想closures连接。

app.get('/drop', function(req, res) { //how to drop the request here }); 

无论你想closures连接,你都可以这样做: res.end()

是的你可以。 所有你需要做的就是调用res.end方法,可选地传入状态码。

使用以下方法之一:

 res.end(); res.status(404).end(); 

如果你想设置标题,那么你可以使用res.set方法。 见下文

 res.set('Content-Type', 'text/plain'); res.set({ 'Content-Type': 'text/plain', 'Content-Length': '123', 'ETag': '12345' }) 

有关详情,请参阅http://expressjs.com/api.html