Releases: lukeed/trouter
Releases · lukeed/trouter
v4.0.0
Breaking
-
Add
exports
map: 20e9cb2
Allows for native Node ESM usage & improves compatibility with recent TypeScript versions. -
Rename
default
export to namedTrouter
export: e53f2af// Before import Trouter from 'trouter'; const Trouter = require('trouter'); // After: import { Trouter } from 'trouter'; const { Trouter } = require('trouter');
-
Changed matching behavior of optional wildcard routes (eg;
/books/*?
): e7c68bc
See[email protected]
release notes
Chores
- Migrate tests from
tape
touvu
: bc03cad - Update CI badge in readme: ebdb0e8
- Migrate from
nyc
toc8
in CI: 9f1a9ec - Rename license file: d1b0d23
Full Changelog: v3.2.1...v4.0.0
v3.2.1
v3.2.0
v3.1.0
Features
-
Support
RegExp
route patterns: (#11): af37967You may use named capture groups, which will automatically set
req.params
values.
However, they're only supported in Node 10.x and above~!Checkout the new documentation from
regexparam
for more details.app.get(/^\/posts[/](?<year>[0-9]{4})[/](?<month>[0-9]{2})[/](?<title>[^\/]+)/i, (req, res) => { console.log(req.params.year); //=> '2019' console.log(req.params.month); //=> '05' console.log(req.params.title); //=> 'hello-world' }); app.find('GET', '/posts/2019/05/hello-world');
Thank you @jirutka for instigating and working on this feature!