Handle OPTIONS requests on the API and fix CORS