add middleware for connect