Add configurable connect middleware