当前位置:网站首页>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 cache and existing problems--cache penetration, cache avalanche, cache breakdown and solutions

学习机赛道加速:请“卷”产品,不要“卷”营销

数据库——概述

DNS 查询原理详解

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

宝塔实测-搭建中小型民宿酒店管理源码

数据源对象管理Druid和c3p0

Redis常用命令

DataFrame insert row and column at specified position

TensorFlow installation steps
随机推荐
unity urp 渲染管线顶点偏移的实现
【结构体内功修炼】结构体实现位段(二)
JS语法使用
JS实现从照片中裁切自已的肖像
向美国人学习“如何快乐”
爬虫从入门到入牢
奇怪的Access错误
外企Office常用英语
SVG星球大战样式Toggle切换开关按钮
支持触屏slider轮播插件
字符串提取 中文、英文、数字
吴恩达深度学习deeplearning.ai——第一门课:神经网络与深度学习——第二节:神经网络基础(下)
Access Denied: "microsoft.web.ui.webcontrols" workaround
Fiddler tool explanation
每一个女孩曾经都是一个没有泪的天使
【无标题】长期招聘硬件工程师-深圳宝安
D2--FPGA SPI接口通信2022-08-03
Use of thread pool (combined with Future/Callable)
JVM运行流程,运行时数据区,类加载,垃圾回收,JMM解析
MySQL 数据库 报错 The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)