Expose function to apply connect.middleware