Skip to content

Releases: lukeed/polka

v0.3.3

09 Feb 19:11
Compare
Choose a tag to compare

Patches

  • FIX: Prevent root-level wildcard routes from stealing middleware requests (#26): dfac4b4

  • Add tests to track middleware-vs-wildcard handling: f4c83d8

  • Update README benchmarks after polka.handler changes: f1a1372

Examples

  • Added examples/with-afterjs: 025614f

v0.3.2

07 Feb 02:07
Compare
Choose a tag to compare

Patches

  • FIX: Defer request property mutations until a sub-group is actually called: 3120116, df98c4c

    Previously, given a global logger, any bware-path would instantly mutate the request object. This means that the information is changed before any part of the loop begins.

    For example, when the global logger actually runs, the wrong URL/pathname is printed.

  • Tests: Chain axios deeply for easier debugging in the future: b0c9c6e

  • Update README benchmarks after polka.handler changes: a9c8d4a

Examples

  • Added examples/with-morgan: e8240a6

    Illustrates the fix in 3120116, preventing regressions.

v0.3.1

03 Feb 04:32
Compare
Choose a tag to compare

Patches

  • FIX: Only mutate req.url and req.pathname if sub-group is known: f4e62bf

    This is an important fix! Any cases of serve-static that were mounted without a basename path were behaving unexpectedly. This is because req.url was mutated as soon as a route-handler was not found, turning incoming assets like /app.js into /, which meant that the target directory's index.html content was always sent.

  • Ensure that sub-groups & basenames always include a leading slash: 531c92d

    This makes it easier & quicker to mutate the req.url and req.pathname values once a sub-group is found.

  • Update README benchmarks after polka.handler changes: d8016cc

Examples

v0.3.0

23 Jan 22:51
Compare
Choose a tag to compare

Features

  • Add onError and onNoMatch options: e431583

  • Mount middleware groups & sub-applications to specific base pathnames (#8): e3c6966

  • Execute sub-applications' included middleware: e3c6966, b23d29f

    We pass off the entire request to the sub-app directly, rather than stealing & reconstructing its routes in the main Polka instance.

  • Offer @polka/send and @polka/send-type response helpers (#5): 815aaef, 2dac7a0

Breaking

  • Remove app.send prototype: 11052b7

    Use @polka/send or @polka/send-type instead.

  • Remove app.start prototype: a24fae2

    Use app.listen instead.

  • Require a base path to mount sub-applications: e3c6966

    • Mutates the req.url once a base app or middleware group has been found
      _ Includes a req.originalUrl value once a base has been matched

Patches

  • Allow asynchronous or dynamically-routed middleware to terminate the response: e3c6966

    A middleware like serve-static can't know ahead of time if it will find a file. Now the app.handler gives it a chance to, rather than exiting immediately.

  • Respond with 404 instead of 405 if no route definition.

Examples

Misc

v0.2.3

23 Jan 22:28
Compare
Choose a tag to compare

Patches

  • Exits the app handler early if no middleware to loop thru: ded9d0b

    Quick little performance win; avoids unnecessary executions.

v0.2.2

16 Jan 06:43
Compare
Choose a tag to compare

Patches

  • Ensure asynchronous middleware functions are awaited: bf626a3, b53874a

    The previous while loop only waited for synchronous res.end or next() calls. If any Promise or Stream based middleware worked, it was purely by luck 😅

  • Update benchmark code & result sets: f8a65b8, f5b3701, 76a0a37

v0.2.1

15 Jan 00:25
Compare
Choose a tag to compare

Patches

  • Ensure req.params is populated with pathname segments only (#6): d64ae9e

v0.2.0

12 Jan 22:01
Compare
Choose a tag to compare

Minor Changes

  • Add support for sub-applications 🎉 (#1): 17f1e85

    This was a core chunk for releasing 1.0. Still not quite ready as there are a few other API decisions to be made, but this takes us most of the way there.

  • Reverted app.handler's signautre to (req, res, parsed): ddbf15c, d72cd14

    Exposing a next callback was completely useless as it would never be called, unless by accident — even though, it shouldn't have been allowed. 😆

    Instead, an optional parsed parameter allows the developer to parse the URL on their own terms, do whatever they want with the info, and then pass down the same information to the (nested?) app handler. Although parseurl is super fast, the fastest function is the one you never call~ 😉

Examples

Patches

  • Removed unused import & renamed parseurl import: 0f559b6
  • Added sub-application tests: b07d146