Add app and middleware to before