Releases: lukeed/trouter
Releases · lukeed/trouter
v4.0.0
Breaking
-
Add
exportsmap: 20e9cb2
Allows for native Node ESM usage & improves compatibility with recent TypeScript versions. -
Rename
defaultexport to namedTrouterexport: 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
Seeregexparam@3.0release notes
Chores
- Migrate tests from
tapetouvu: bc03cad - Update CI badge in readme: ebdb0e8
- Migrate from
nyctoc8in 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
RegExproute patterns: (#11): af37967You may use named capture groups, which will automatically set
req.paramsvalues.
However, they're only supported in Node 10.x and above~!Checkout the new documentation from
regexparamfor 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!