Added createMiddleware call
Moved urlencoded and json middleware before the app router gets initialized