simple promise-based middleware kernel