Right now the middleware system assumes functions that are executed without needing any logic in promises or callbacks. Adopting the next() pattern used by express & vue-router (among others) would let us provide much more robust middleware options. Should look at this as part of the Graphiti move.