Skip to content

Releases: lukeed/trouter

v4.0.0

04 Dec 15:21
Compare
Choose a tag to compare

Breaking

  • Add exports map: 20e9cb2
    Allows for native Node ESM usage & improves compatibility with recent TypeScript versions.

  • Rename default export to named Trouter 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


Full Changelog: v3.2.1...v4.0.0

v3.2.1

22 Feb 02:28
Compare
Choose a tag to compare

Patches

Chores


Full Changelog: v3.2.0...v3.2.1

v3.2.0

27 Mar 16:13
Compare
Choose a tag to compare

Features

  • Include TypeScript definitions file (again): b3e8810
    Thank you @fwilkerson and @stahlstift

Chores

  • Include Node 12.x and Node 14.x to TravisCI: 537eaf9
  • Update package.json meta: c24fe2b
  • Update bund version: 6676048
  • Update README usage: ad853d6

v3.1.0

11 Jul 05:08
Compare
Choose a tag to compare

Features

  • Support RegExp route patterns: (#11): af37967

    You 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!

Chores

  • Remove & hide package-lock.json file: 3671881
  • Pin versions for devDependency modules: b87fd7b

v1.1.0

02 May 22:04
Compare
Choose a tag to compare

Minor Changes

  • Added .all(pattern, handler) method, matching all HTTP verbs: 554e156, e14c418, a69f2a7
    However, method-specific entries outrank entries via all() using the same pattern.

Patches

  • Delay this.routes[METHOD] and this.handlers[METHOD] creation until actually needed: 84c7fae
    Results in less memory consumption, which actually yields a performance gain!

  • Update benchmark suite & results: 9cc2953, 02022b5

v0.1.1

23 Dec 04:27
Compare
Choose a tag to compare

Patches

  • Allow .add|method to be chainable: 6df84c5

    Enables chained definitions:

    new Trouter()
        .get('/foo', (req, res) => {})
        .get('/bar/:baz', (req, res) => {})