当前位置:网站首页>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
边栏推荐
- Insights in programming
- [Structural Internal Power Cultivation] The Mystery of Enumeration and Union (3)
- DNS 查询原理详解
- v-if/v-else determines whether to display according to the calculation
- pnpm 是凭什么对 npm 和 yarn 降维打击的
- Nn. Unfold and nn. The fold
- CROS和JSONP配置
- 【结构体内功修炼】枚举和联合的奥秘(三)
- TensorFlow安装步骤
- iptables实现网络限制下ntp自定义端口同步时间
猜你喜欢
Mysql 死锁和死锁的解决方案
DataFrame在指定位置插入行和列
Use of thread pool (combined with Future/Callable)
ps怎么把图片变清晰,自学ps软件photoshop2022,简单快速用ps让照片更清晰更有质感
Adb 授权过程分析
Fiddler工具讲解
强网杯2022 pwn 赛题解析——house_of_cat
MobileNetV1架构解析
DNS 查询原理详解
MySQL 数据库 报错 The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
随机推荐
DataFrame insert row and column at specified position
【结构体内功修炼】枚举和联合的奥秘(三)
力扣刷题八月第一天
[Structure internal power practice] Structure memory alignment (1)
Vulnhub target drone: HA_ NARAK
busybox 知:构建
ps怎么把图片变清晰,自学ps软件photoshop2022,简单快速用ps让照片更清晰更有质感
别把你的天使弄丢了
向美国人学习“如何快乐”
2006年星座运势全解-巨蟹
嵌入式系统:基本定时器
MySQL 数据库 报错 The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
常用的遍历map的方法
Redis实现分布式锁-原理-问题详解
基于多块信息提取和马氏距离的k近邻故障监测
browserslist 选项的目的是什么?
宝塔实测-搭建中小型民宿酒店管理源码
TensorFlow安装步骤
Adb 授权过程分析
Antdesign a-select 下拉框超出长度换行显示