{"title":"File Download","description":"","section":"cookbook","version":"v1.5","path":"cookbook/file-download","canonical_url":"https://amberframework.org/docs/v1.5/cookbook/file-download","markdown_url":"https://amberframework.org/docs/v1.5/cookbook/file-download.md","inherited":true,"content_markdown":"# File Download\n\nThis recipe will help you to setup a static file handler 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 |app|\n  # All static content will run these transformations\n  pipeline :static do\n    plug Amber::Pipe::PoweredByAmber.new\n    plug Amber::Pipe::Error.new\n    plug Amber::Pipe::Static.new(\"./public\")\n  end\n\n  routes :static do\n    get \"/*\", Amber::Controller::Static, :index\n  end\nend\n```\n{% endcode-tabs-item %}\n{% endcode-tabs %}\n\nAlso see [pipelines](../guides/routing/pipelines.md).\n\n{% hint style=\"success\" %}\nThis code is already included on projects generated by [Amber CLI](../cli/)\n{% endhint %}"}