Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

main

v1.0.2
github.com/Azaki-san/chi/_examples/fileserver

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

2 matches

Top ↑

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.

Dependency graph