egg routing

By home.js under the controller in the app directory

will

 

 The index was originally written in exchange for the news on hi news

Then add in router.js

router.get('/news', controller.home.news);
Then save

 

Refresh came out

 

 

 Pass dynamic values

 It must be filled by value or the corresponding values ​​after the error 404

 

 Get the value of the dynamic routing passed

var  params =this.ctx.params

 

 

 

 

 

 By var qurery = this.ctx.query

Console prints out newslist / id value behind

 

Guess you like

Origin www.cnblogs.com/yangjingyang/p/11469855.html
Recommended