当前位置:网站首页>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
边栏推荐
- Redis implements distributed lock-principle-detailed explanation of the problem
- 真正爱你的女人是这样的
- 强网杯2022 pwn 赛题解析——house_of_cat
- Basic introduction of stack and queue and C language implementation of functions such as creation, destruction, entry and exit, counting the number of elements, viewing elements, etc., as well as stac
- DataFrame在指定位置插入行和列
- unity urp 渲染管线顶点偏移的实现
- 作为一个男人必须明白的22个道理
- 【结构体内功修炼】结构体实现位段(二)
- DNS 查询原理详解
- Chapter3、色调映射
猜你喜欢

七夕?编程?

Redis cache and existing problems--cache penetration, cache avalanche, cache breakdown and solutions

DataFrame在指定位置插入行和列

Support touch screen slider carousel plugin

Algorithm Supplements Fifteen Complementary Linked List Related Interview Questions

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

MVCC of Google's Fragmented Notes (Draft)

unity urp 渲染管线顶点偏移的实现

MobileNetV1架构解析

uniapp time component encapsulates year-month-day-hour-minute-second
随机推荐
JS实现从照片中裁切自已的肖像
基于 Docker 快速使用远程(云)数据库
网络安全研究发现,P2E项目遭遇黑客攻击只是时间问题
egg框架
向美国人学习“如何快乐”
别把你的天使弄丢了
Iptables implementation under the network limited (NTP) synchronization time custom port
关于MP3文件中找不到TAG标签的问题
吴恩达深度学习deeplearning.ai——第一门课:神经网络与深度学习——第二节:神经网络基础(下)
uniapp时间组件封装年-月-日-时-分-秒
openSource 知:社区贡献
Adb 授权过程分析
[Repost] Marry a man must marry a man whose salary is at least 3571.4 yuan higher than yours
餐饮大单品「真香」,却没有穿透周期的能力
iptables实现网络限制下ntp自定义端口同步时间
CROS和JSONP配置
8.4模拟赛总结
unity 头发的渲染
图片地址转为base64
VXE-Table融合多语言