Add connect middlewares for the server