node.js中express框架大小写

今天突然发现,在express创建的接口中,Router路径是不区分大小写的,但是,JavaScript是区分大小写的。

var express = require('express');
var app = express();

app.use('/testExpress',function  (req,res) {
	res.send('Test');
	res.end();
});

app.get('/testGetRequest/lowerCase',function  (req,res) {
	res.send('get请求测试');
});
app.listen(8089,function () {
	console.log('启动成功');
});

结果你在测试结果的时候,发现访问http://127.0.0.1:8089/testgetrequest/lowerCase和访问http://127.0.0.1:8089/testgetrequest/lowerCASE得到的结果是一样的。

参考学习博客:

https://blog.csdn.net/weixin_34228662/article/details/86802566

猜你喜欢

转载自blog.csdn.net/ioszhanghui/article/details/90412974
今日推荐