add connect middleware