software applications beyond those available from the operating system. It can be described as "software glue”. ▸ Ruby on Rails and Koa.js have robust middleware systems so deal with requests before they’re handled by the main application ▸ Middleware on the server is used to address cross-cutting concerns like authentication, authorization, logging, gathering performance metrics, etc.
Redux middleware the main execution task is the store’s dispatch function. ▸ The dispatch function is responsible for sending actions to one or many reducer functions for state changes. ▸ Redux middleware is designed by creating functions that can be composed together before the main dispatch method is invoked.
meant to be pure functions without any side effect. ▸ Async by its very nature is all about side effects: fetching / posting data, reads/ writes to localStorage, etc. ▸ To build a complete architecture, you need to use Redux middleware
passing in special functions to your each middleware along the chain ▸ It passes functions for getting the state, dispatching new actions, and calling the following middleware ▸ It is the job of your middleware to know when it’s finished and pass the action to the next middleware
arguments, returning a function that takes the remaining arguments ▸ This is useful if you want to apply an argument to a function before you have the rest of the arguments it needs ▸ Redux uses currying to chain middleware before the store is created, and to pass in functions that don’t quite exist yet.
Redux store. ▸ It’s not the actual store: rather it’s an object that contains methods from the store you might want to use ▸ You get 2 functions from this store object: getState() and dispatch()
of middlewares. Perhaps it should have been called nextMiddleware() for clarity ▸ Only your middleware knows when it’s finished and hands over control of the action to the next middleware