CORSMiddleware function

Creates CORS middleware object