Add middleware for connect framework.