Releases: reno-router/reno
Migrates to jspm for Sinon in order to resolve #1
v1.0.0-alpha.2 Migrates to jspm for Sinon in order to resolve #1
First alpha of 1.0.0! 🎉
Supports Deno 1.0.0.
Breaking changes
withJsonBody()
andwithFormBody()
higher-order handlers will now throw an error if theContent-Length
header is not set (usually occurs when the expected request body is missing), which is required since internally migrating toBufReader
to convert request bodies to strings
Updates Deno version to v0.31.0
Just some housekeeping to ensure Reno supports the latest release of Deno.
Resolves null iteration bug in route lookup
Provides a fallback array for url.pathname.match()
in route lookup, and validates by consuming actual path parser implementation in the router's unit tests.
Pulls Sinon type def as remote import
This was resulting in a broken fetch for consuming projects.
Fixes a router lookup bug
v0.6.2 Moves current README to template so version numbers are injectable
Allows pipe transform return to be optional
This avoids redundantly returning the received response from a pipe transformation when mutating said response:
const withCaching = pipe(
(req, res) => {
res.headers.append("Cache-Control", "max-age=86400");
// no return statement required
}
);
Adds pipe() for creating reusable route logic
Adds pipe()
for creating reusable route logic. It's conceptually similar to Express' middleware pattern, but leverages function piping to create reusable, higher-order route handlers:
import { createRouteMap, jsonResponse, pipe } from "https://raw.githubusercontent.com/jamesseanwright/reno/v0.6.0/reno/mod.ts";
const withCaching = pipe(
(req, res) => {
res.headers.append("Cache-Control", "max-age=86400");
return res;
},
(req, res) => ({
...res,
cookies: new Map<string, string>([["requested_proto", req.proto]])
})
);
const home = withCaching(() =>
jsonResponse({
foo: "bar",
isLol: true
})
);
export const routes = createRouteMap([["/", home]]);
Updates Content-Type header ordering in response helpers
Any Content-Header
value specified when calling textResponse
or jsonResponse
will override the default value.
Abstracts RouteMap constructor with createRouteMap export
See README example for new route map contract.