{"title":"CORS","description":"","section":"cookbook","version":"v1.5","path":"cookbook/cors","canonical_url":"https://amberframework.org/docs/v1.5/cookbook/cors","markdown_url":"https://amberframework.org/docs/v1.5/cookbook/cors.md","inherited":true,"content_markdown":"# CORS\n\nThis recipe will help you to setup a [Cross-Origin Resource Sharing](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) pipe in your application.\n\n{% hint style=\"warning\" %}\nFirst you need an amber project generated with [Amber CLI](../guides/create-new-app.md) or [from scratch](from-scratch.md).\n{% endhint %}\n\n{% code-tabs %}\n{% code-tabs-item title=\"config/application.cr\" %}\n```crystal\nAmber::Server.configure do\n  pipeline :api do\n    plug Pipe::CORS.new\n  end\n  \n  routes :api do\n    # your routes here...\n  end\nend\n```\n{% endcode-tabs-item %}\n{% endcode-tabs %}\n\nAlso see [pipelines](../guides/routing/pipelines.md)."}