标签: node.js express
正常使用Express时,您可以使用app.post('/path')或app.get('/path')来定义路线。
app.post('/path')
app.get('/path')
Express还提供了一个函数来定义像app.route('POST', '/path')这样的路线(其中route是我正在寻找的功能)?
app.route('POST', '/path')
route
答案 0 :(得分:1)
您可以通过编程方式选择带括号表示法的方法。例如:
app['post']('/path') app['post']('/path-2') app['get']('/path')