express middleware for cosmonaut