Home  >  Article  >  Backend Development  >  node.js - 为什么 nodejs没有内置像PHP的$POST或$GET

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

WBOY
WBOYOriginal
2016-06-06 20:37:12992browse

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

回复内容:

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

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

function(req,res){
    yourselfConnect(req,res);
}

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

Statement:
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