Add ability to define middleware in the config