当前位置:网站首页>routing----router
routing----router
2022-08-05 08:09:00 【cjx177187】
Route describes the correspondence between the request URL and the Controller that is responsible for executing the action.To put it bluntly, when users access different paths, there should be different Controllers to respond to different content.
router.get('/getdata', controller.form.get);//Static routing
Template syntax:
'use strict';
/**
* @param
*/
module.exports = app
const { router, controller
router.get('/', controller.home.index);
};
Route matching process:
- Whenever a request arrives at the server, it needs to be matched by the route first. Only after the match is successful, the corresponding processing function will be called.
- When matching, it will be matched according to the order of routing configuration; if the request type and request URL are matched successfully at the same time, EXpress will hand over the request to the corresponding function for processing.
Note:
Match in the defined order
Request type and requestURLThe corresponding function will be called only if the match is successful at the same time
When registering a route, the route name should not conflict with the static file name, otherwise static resources will be preferentially accessed.When the route names are the same, the one registered first is executed first
边栏推荐
- 学习机赛道加速:请“卷”产品,不要“卷”营销
- [Structural Internal Power Cultivation] The Mystery of Enumeration and Union (3)
- SVG big fish eat small fish animation js special effects
- unity 头发的渲染
- 星座理想情人
- 高端无主灯设计灯光设计该如何布置射灯灯具?
- D2--FPGA SPI interface communication2022-08-03
- 网络安全研究发现,P2E项目遭遇黑客攻击只是时间问题
- JVM运行流程,运行时数据区,类加载,垃圾回收,JMM解析
- MM上街前的折腾(有趣)
猜你喜欢
随机推荐
C-Eighty seven(背包+bitset)
Mysql 死锁和死锁的解决方案
关于MP3文件中找不到TAG标签的问题
监听浏览器刷新操作
外企Office常用英语
执子之手,与子偕老。你同意么?
爬虫从入门到入牢
Data source object management Druid and c3p0
[Structural Internal Power Cultivation] Structural Realization Stages (2)
Vulnhub target drone: HA_ NARAK
RedisTemplate: error template not initialized; call afterPropertiesSet() before using it
8.4模拟赛总结
星座理想情人
宝塔实测-搭建中小型民宿酒店管理源码
window.open 全屏展示
彩绘漂亮MM集
ps怎么替换颜色,自学ps软件photoshop2022,ps一张图片的一种颜色全部替换成另外一种颜色
D2--FPGA SPI interface communication2022-08-03
真正爱你的女人是这样的
请问my sql如何把两个表的内容集合在一起啊?









