Package Exports
- express-urlrewrite
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-urlrewrite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
express-urlrewrite
URL rewrite middleware for express.
Examples
Rewrite using a regular expression, rewriting /i123 to /items/123.
app.use(rewrite(/^\/i(\w+)/, '/items/$1'));Rewrite using route parameters, references may be named
or numeric. For example rewrite /foo..bar to /commits/foo/to/bar:
app.use(rewrite('/:src..:dst', '/commits/$1/to/$2'));
app.use(rewrite('/:src..:dst', '/commits/:src/to/:dst'));You may also use the wildcard * to soak up several segments,
for example /js/vendor/jquery.js would become
/public/assets/js/vendor/jquery.js:
app.use(rewrite('/js/*', '/public/assets/js/$1'));In the above examples, the query string (if any) is left untouched. The regular expression is applied to the full url, so the query string can be modified as well:
app.use(rewrite('/file\\?param=:param', '/file/:param'))The query string delimiter (?) must be escaped for the regular expression to work.
Debugging
Set environment variable DEBUG=express-urlrewrite