added connect middleware and other middleware.