大佬教程收集整理的这篇文章主要介绍了node.js – 使用koa-router获取请求参数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
router .get('/',function *(next) { yield this.render('index.ejs',{ title: 'title set on the server' }); }) .get('/endpoint:id',function *(next) { console.log('/endpoint:id'); console.log(this.params); this.body = 'Endpoint return'; })@H_489_5@有关参数的koa-router文档 @H_489_5@
//Named route parameters are captured and added to ctx.params. router.get('/:category/@R_417_6964@',function *(next) { console.log(this.params); // => { category: 'progrAMMing',title: 'how-to-node' } });@H_489_5@请求角度控制器: @H_489_5@
$http.get('/endpoint',{params: { id: 223 }}) .then( function(responsE){ var respnse = response.data; console.log(responsE); } );
.get('/endpoint/:id',function *(next) { console.log(this.params); this.body = 'Endpoint return'; })@H_489_5@请求#查询 @H_489_5@
.get('/endpoint/',function *(next) { console.log(this.query); this.body = 'Endpoint return'; })@H_489_5@请求#PARAM @H_489_5@
.get('/endpoint/:id',function *(next) { console.log(this.params); this.body = 'Endpoint return'; })
以上是大佬教程为你收集整理的node.js – 使用koa-router获取请求参数全部内容,希望文章能够帮你解决node.js – 使用koa-router获取请求参数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。