app.use("/api",router)
时间: 2024-04-25 16:22:10 浏览: 74
Express中app.use中间件的用法-匹配所有的请求方式示例代码.zip
app.use("/api",router)是在Express应用中使用了app.use()方法来将路由配置文件router.js导入到路径为"/api"下。这样,当访问"/api"路径时,会使用router.js中定义的路由配置进行处理。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *2* [【Express】app.use()的使用](https://blog.csdn.net/weixin_37746009/article/details/101042940)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [app.use()](https://blog.csdn.net/fkkkkkf/article/details/127710416)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文