Skip to content

Better createConfig

Pre-release
Pre-release

Choose a tag to compare

@pshrmn pshrmn released this 20 Apr 05:25
· 1492 commits to master since this release

curi

This covers both the 0.5.0 and 0.6.0 releases of curi.

Instead of exporting createConfig as a named export, the createConfig function is now the default export for curi.

Additionally, createConfig's third argument has changed. Instead of being an addons array, it is now an options object. This object currently has two valid properties: addons and middleware. The addons property is the array that used to be the third argument to createConfig. The middleware property is an array of middleware functions.

Middleware functions are functions that get called once the response object has been created, but prior to the subscriber functions being called. Middleware gives you the opportunity to modify the response that will be passed to the subscriber functions. A middleware function will receive the response object as its argument and must return a response object. The middleware functions will be called in the order they are provided in the middleware array.

curi-middleware-query

The curi-middleware-query package was created. It exports a middleware factory function, which assists in creating a middleware function that parses a response's location.search to generate a query object.