main
v5.5.0
github.com/go-chi/chi/v5/_examples/fileserver
Documentation
pkg.go.dev ↗This example demonstrates how to serve static files from your filesystem.
Boot the server:
$ go run main.go
Client requests:
$ curl http://localhost:3333/files/ <pre> <a href="notes.txt">notes.txt</a> </pre> $ curl http://localhost:3333/files/notes.txt Notessszzz
Functions
FileServer
func FileServer(r chi.Router, path string, root http.FileSystem)
FileServer conveniently sets up a http.FileServer handler to serve static files from a http.FileSystem.