express4.x中的链式路由句柄
2024-10-14 21:58:13
var express = require("express");
var router = express(); router.get('/', function (req, res) {
res.render('articles', {titles: '文章页', content: '这是文章页的内容,method==' + req.method});
})
.post('/', function (req, res) {
res.json({msg: "添加文章成功"})
})
.put('/', function (req, res) {
if (req.body.id) {
res.json({msg: "文章修改成功"})
}
}); module.exports = router;
最新文章
- Java 进阶 hello world! - 中级程序员之路
- Lua 与 Redis
- iOS 阶段学习第23天笔记(XML数据格式介绍)
- Python统计百分比及排序
- UVa 10055 - Hashmat the Brave Warrior
- textView字体颜色根据不同状态显示不同颜色
- tachyon 编译
- ZOJ 2563	Long Dominoes(状压DP)
- 按照行拆分textarea
- 安装ArchLinux的参考分区方案
- There is no result type defined for type 'json' mapped with name 'success'. Did you mean 'json'?
- 一口一口吃掉Hibernate(八)——Hibernate中inverse的用法
- Swiftly语言学习1
- 寻找与疾病相关的SNP位点——R语言从SNPedia批量提取搜索数据
- [原创] IAR7.10安装注册教程
- SqlServer和Oracle中一些常用的sql语句4 局部/全局变量
- 适配器模式 adapter 结构型 设计模式(九)
- Linux 匿名页的反向映射
- AngularJS 作用域(Scope)
- python 学习第四天
热门文章
- 【中国剩余定理】【容斥原理】【快速乘法】【数论】HDU 5768 Lucky7
- 【贪心】XMU 1061 Ckp的约会
- ISNULL-sqlserver语句
- LeetCode——Two Sum
- HDU_1429——胜利大逃亡续,十位二进制状态压缩,状态判重
- migration vmware vms to openstack kvm 修改vmware windows scsi to ide
- uploadify在struts2下的使用
- 港股street和nominee区别
- Kernel 4.9的BBR拥塞控制算法。
- CodeForces 146E - Lucky Subsequence DP+扩展欧几里德求逆元