[英]Express Js Routing
api route: api路线:
/Token?l=Spanish&n=NameofTheServer&m0=Email&m1=&m2=&m3=&m4=&m5=&m6=&m7=&m8=&m9=&m10=&m11=&m12=&m13=&m14=&m15=&m16=&m17=&m18=&m19&v=VersionOfTheServer&hw=NumberOfTheHardware
This is my route, i want to write it on the express route using regex 这是我的路线,我想使用regex在快速路线上写出来
router.post('/:token?/:Language/:NameOfTheServer/:Email...)
So i can retrieve the information on a console log so i can get the Token + the Language + the Name of the Server + the Version + the Number of the hardware. 因此,我可以在控制台日志上检索信息,以便获得令牌+语言+服务器名称+版本+硬件编号。
when you will hit this api: /token?l=spenish&n=NameofTheServer&m0=Email
当您将要使用此api时:
/token?l=spenish&n=NameofTheServer&m0=Email
route.post('/token, function(req,res, next){
//console.log(req.query)
// here it will be available some thing like this
//req.query = {l: 'spenish',n:'NameofTheServer', m0:'Email'}
});
or if you pass your data in body you can access it in req.body
. 或者,如果您在主体中传递数据,则可以在
req.body
访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.