File Download
This recipe will help you to setup a static file handler in your application.
First you need an amber project generated with Amber CLI or from scratch.
config/application.cr
1
Amber::Server.configure do |app|
2
# All static content will run these transformations
3
pipeline :static do
4
plug Amber::Pipe::PoweredByAmber.new
5
plug Amber::Pipe::Error.new
6
plug Amber::Pipe::Static.new("./public")
7
end
8
9
routes :static do
10
get "/*", Amber::Controller::Static, :index
11
end
12
end
Copied!
Also see pipelines.
This code is already included on projects generated by Amber CLI
Last modified 3yr ago
Copy link