How to parse/read multiple parameters with restify framework for Node.JS

一笑奈何 提交于 2019-11-29 02:53:06
Simon

You just need to load the query parser plugin like so;

server.use(restify.plugins.queryParser());

Restify 5 (2017) answer:

As of restify 5 you can now setup the query parser like this: server.use(restify.plugins.queryParser());.

If you use this plugin you can access the parsed params in req.query.

For additional options and information, take a look into the restify documentation: http://restify.com/docs/plugins-api/#queryparser

Simon's answer is no longer valid as restify's queryParser has been moved to the restify-plugins package. The updated solution is

server.use(require('restify-plugins').queryParser());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!