Add middlewares and its mechanism, move routes and handlers to app specific pkg