我想知道像这样 http://localhost:3000/calendar/event?action=add&date=2015-02-01 的url应该怎样在express路由里面配置才能获取到后面的日期
回复 (4)
D
引用 chinghanhoreq.query An object containing a property for each query string parameter in the route. If there...
@chinghanho 正解,不管你是req的method是POST还是GET,url中的参数都被解析到req.query里去了。可以自己使用url模块实验下...如果没记错,url里面也用的是querystring...@HyperJianXin
J
路由和正常的一样,后面的可以作为传入参数在req参数中。
H
C
req.query
An object containing a property for each query string parameter in the route. If there is no query string, it is the empty object, {}.
参与回复
登录后即可参与回复。登录