app.route(path)
返回一个单例模式的路由的实例,之后你可以在其上施加各种HTTP动作的中间件。使用app.route()来避免重复路由名字(因此错字错误)—说的意思应该是使用app.router()这个单例方法来避免同一个路径多个路由实例。
var app = express();app.route('/events').all(function(req, res, next) {// runs for all HTTP verbs first// think of it as route specific middleware!}).get(function(req, res, next) {res.json(...);}).post(function(req, res, next) {// maybe add a new event...})
