Express middleware implementation.