Route urls through middleware functions on both client and server.
middle-router is a universal front-end router for routing urls changes through a series of async middleware functions. This allows you to perform multiple tasks when the url changes, instead of just updating the view.
Note: These usage examples use Express and React, and resolve each url to a React element. middle-router has no dependency on these, and can be used with whatever libraries you like.
Full API documentation is in the GitHub Wiki
middle-router can work with any promised-based async middleware, but it was designed specifically for async functions. Inspired by koa's
yield next, middle-router allows you to
await next() so you can
next() "downstream" and the
await for control to flow back "upstream".
This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.