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

SVG big fish eat small fish animation js special effects

ps怎么替换颜色,自学ps软件photoshop2022,ps一张图片的一种颜色全部替换成另外一种颜色

强网杯2022 pwn 赛题解析——house_of_cat

MongoDB 语法大全
![[Structure internal power practice] Structure memory alignment (1)](/img/31/4ddc16810da8238ac95a93d007e12e.png)
[Structure internal power practice] Structure memory alignment (1)

数据源对象管理Druid和c3p0

七夕?编程?

Ethernet Principle

吴恩达深度学习deeplearning.ai——第一门课:神经网络与深度学习——第二节:神经网络基础(下)

Algorithm Supplements Fifteen Complementary Linked List Related Interview Questions
随机推荐
php向mysql写入数据失败
小本创业者的致胜法宝!
moment的使用
彩绘漂亮MM集
Game Thinking 19: Multi-dimensional calculation related to games: point product, cross product, point-line-surface distance calculation
8.4模拟赛总结
DataFrame insert row and column at specified position
创业者如何吸引风险投资商
pnpm 是凭什么对 npm 和 yarn 降维打击的
Iptables implementation under the network limited (NTP) synchronization time custom port
【结构体内功修炼】枚举和联合的奥秘(三)
支持触屏slider轮播插件
在ASP控制数字及字母输入
控制器-----controller
达梦数据库大表添加字段
[Structural Internal Power Cultivation] The Mystery of Enumeration and Union (3)
数据源对象管理Druid和c3p0
线性代数对角化
撕裂寂寞
Ethernet Principle