javascript - NodeJS Express 4.0 routing regex error -
after updating express module 4.0 version following url regexp stop working:
app.get("/admin/list001/(userid/:userid)?/(name/:name)?/(email/:email)?/order/:order/field/:field/first/:first/rows/:rows/curriculums.:format(json)", function(request, response){
syntaxerror: invalid regular expression: /^\/admin\/list001\/(?(?:([^\/]+?))\/(?:([^\/]+?)))?\/name(?:\/([^\/]+?))?\/email(?:\/([^\/]+?))?\/order\/(?:([^\/]+?))\/field\/(?:([^\/]+?))\/first\/(?:([^\/]+?))\/rows\/(?:([^\/]+?))\/curriculums(?:\.(json))\/?$/: invalid group
there other way of achieving same result?
edit: (progress)
/admin/list001(/userid/:userid)?(/name/:name)?(/email/:email)?(/order/:order)?(/field/:field)?(/first/:first)?(/rows/:rows)?/curriculums.:format(json)
this works. request.params vars don't catch right values:
{ '0': '/field/userid', '1': 'userid', '2': '/first/0', '3': '0', '4': '/rows/20', '5': '20', '6': 'json', userid: '/userid/true', name: 'true', email: '/name/true', order: 'true', field: '/email/true', first: 'true', rows: '/order/desc', format: 'desc' }
Comments
Post a Comment