node.js - 为什么 nodejs没有内置像PHP的$POST或$GET

WBOY
Release: 2016-06-06 20:37:12
Original
1092 people have browsed it

如果没有使用express(body-parser),怎么优雅地解析post数据?

回复内容:

如果没有使用express(body-parser),怎么优雅地解析post数据?

nodejs更接近底层,所合http模块没有提供更高成的封装只是在listener里传入request,response参数供处理,
express也是加入了中间件(body-parser)进行解析,当然如果有必要是可以自己实现中间层的

<code>function(req,res){
    yourselfConnect(req,res);
}
</code>
Copy after login

你可以使用Node的一些HTTP模块,类似这个一样:链接描述

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!