[now dev] Use pcre-to-regexp to match routes (#2027)

* [now dev] Use `pcre-to-regexp` to match `routes`

The now.json `routes` support PCRE syntax like named captures,
so use the `pcre-to-regexp` module to match the routes.

Fixes #2023.

* Pass the resolved router `dest` and query params to the Lambda
This commit is contained in:
Nathan Rajlich
2019-03-27 18:37:43 -07:00
committed by Leo Lamprecht
parent 6c8dc90267
commit fd3c110c02
6 changed files with 48 additions and 7 deletions

View File

@@ -36,7 +36,7 @@ test('[dev-router] captured groups', t => {
test('[dev-router] named groups', t => {
const routesConfig = [
{ src: '/user/(?<id>.+)', dest: '/user.js?id=$<id>' }
{ src: '/user/(?<id>.+)', dest: '/user.js?id=$id' }
];
const result = devRouter('/user/123', routesConfig);