Use app.middleware to register handlers