This release revamps the middleware system to support pre- and post-routing middleware, converting middleware exceptions to error responses, and specifying middleware using WebAppSettings.middleware
. This release also adds a slew of middleware that are useful for web applications:
useIsSecureRequestMiddleware
- Record on request whether it was delivered via a secure channel.useHstsMiddleware
- Inform browsers that your app should only be visited via HTTPS.useStaticFilesMiddleware
- Serves static files.useRoutingMiddleware
- Adds the ability to route a request to a handler. Must be used with and called beforeuseHandlerMiddleware
.useBrowserHardeningMiddleware
- Harden the browser environment your web app is rendered in.useHandlerMiddleware
- Calls a selected handler after routing. Must be used with and called afteruseRoutingMiddleware
.
Static file handling has been moved to a middleware to allow for short-circuting the middleware chain when static files are requested.
What's Changed
- Add Web Application Middleware by @kyleingraham in #9
Full Changelog: v0.4.0...v0.5.0