摘要: 一共有4种解析方式 urlencoded、json、text 、raw 发起请求的form表单中可以设置三种数据编码方式 application/x-www-form-urlencoded、multipart/form-data、text/plain 异步请求可以设置 xhr.setRequestH 阅读全文
posted @ 2018-05-13 22:59 甜珊贝奇 阅读(747) 评论(0) 推荐(0) 编辑
摘要: req.fresh req.stale var version = 100; app.get('/test',function(req,res){ res.set('etag',version); if(req.fresh){ res.send(); }else{ res.send('version 阅读全文
posted @ 2018-05-13 21:21 甜珊贝奇 阅读(175) 评论(0) 推荐(0) 编辑
摘要: req.method -->GET req.hostname -->127.0.0.1 req.originalUrl -->/test/test/test?name=wang req.protocol -->http req.path -->/test/test/test req.params - 阅读全文
posted @ 2018-05-13 12:11 甜珊贝奇 阅读(257) 评论(0) 推荐(0) 编辑
摘要: const express= require('express'); const app = express(); app.use('/public',express.static(__dirname+'public')); 第一个参数:访问路径 ,第二个参数:静态资源路径 app.use('/pu 阅读全文
posted @ 2018-05-13 11:54 甜珊贝奇 阅读(130) 评论(0) 推荐(0) 编辑
摘要: /abc?d 表示c可有可无 /abc+d c至少出现一次或者多次,末尾必须有d /abc\*d c和d之间可以有任意多个字符,但是末尾必须有d /a(bc)?d bc可有可无 /a(bc)+d bc至少出现一次或者多次,末尾必须有d /\/ab[1,2]cd/ 正则匹配 ['abc?d','abc 阅读全文
posted @ 2018-05-13 10:13 甜珊贝奇 阅读(203) 评论(0) 推荐(0) 编辑