Skip to content

Commit abdce88

Browse files
author
xiaolongXL
committed
update document
1 parent 7762fbe commit abdce88

3 files changed

Lines changed: 2 additions & 16 deletions

File tree

doc/day1_express.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ Response对象是有关于对客户端请求之响应,可以利用它来设定
218218
```
219219

220220
说明一下
221+
例如定义两个路由,一个对应get请求,一个对应post请求;
221222

222223
### session
223224

@@ -289,9 +290,6 @@ app.js里
289290

290291
区分express.static和http-server的差别:功能一样,用法上有差异
291292

292-
http-server只做静态托管文件,输出请求文件,无法拦截到请求参数;
293-
express.static不仅可以托管静态文件,并且提供接口可以拦截到前端页面的请求参数,并且可以控制返回数据;(这句是错的)
294-
295293
#### 路由冲突
296294

297295
`public/index.html`和路由的`/`冲突
@@ -398,19 +396,7 @@ module.exports = router;
398396

399397
/* GET http.*/
400398
router.get('/', function(req, res) {
401-
var sUrl = req.url;
402-
var arr = sUrl.split('?');
403-
var arrReq = arr[1].split('&');
404-
var resJson = {};
405-
406-
for(var i=0; i<arrReq.length; i++){
407-
//['xx=xx','xx=xx']
408-
var newarr = arrReq[i].split('=');
409-
var attr = newarr[0];
410-
var value = newarr[1];
411-
resJson[attr] = value;
412-
};
413-
res.send(resJson);
399+
res.send(req.query);
414400
});
415401

416402
module.exports = router;

doc/images/expressimg4.jpg

-247 KB
Loading

doc/images/expressimg5.jpg

-213 KB
Loading

0 commit comments

Comments
 (0)