当前位置:网站首页>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
边栏推荐
猜你喜欢

Game Thinking 19: Multi-dimensional calculation related to games: point product, cross product, point-line-surface distance calculation

Redis常用命令

爬虫从入门到入牢

php向mysql写入数据失败

unity 头发的渲染

Illegal key size 报错问题

爬虫之验证码

SVG大鱼吃小鱼动画js特效
![[Structural Internal Power Cultivation] Structural Realization Stages (2)](/img/eb/c80e12edbf4a411227be7e33096ed3.png)
[Structural Internal Power Cultivation] Structural Realization Stages (2)
![[Structure internal power practice] Structure memory alignment (1)](/img/31/4ddc16810da8238ac95a93d007e12e.png)
[Structure internal power practice] Structure memory alignment (1)
随机推荐
SQL SERVER on master-slave table trigger design
browserslist 选项的目的是什么?
Insights in programming
星座理想情人
VXE-Table融合多语言
U++ 创建UI
利用Jenkins的持续集成
图扑软件与华为云共同构建新型智慧工厂
moment的使用
JS实现从照片中裁切自已的肖像
常用的遍历map的方法
程序设计中的感悟
导出SQLServer数据到Excel中
学习机赛道加速:请“卷”产品,不要“卷”营销
[转帖]嫁人一定要嫁工资至少比你高3571.4元的男士
网络安全研究发现,P2E项目遭遇黑客攻击只是时间问题
How Entrepreneurs Attract Venture Capitalists
线性代数对角化
基于 Docker 快速使用远程(云)数据库
SQL SERVER关于主从表触发器设计