Implemented base connect middleware wrapper