mirror of
https://git.sr.ht/~adnano/go-gemini
synced 2024-11-23 04:22:01 +01:00
doc: Fix Mux documentation
This commit is contained in:
parent
fae6fb2a81
commit
0e0598f086
6
doc.go
6
doc.go
@ -30,7 +30,7 @@ Servers should be configured with certificates:
|
|||||||
server.GetCertificate = certificates.Get
|
server.GetCertificate = certificates.Get
|
||||||
|
|
||||||
Mux is a Gemini request multiplexer.
|
Mux is a Gemini request multiplexer.
|
||||||
Mux can handle requests for multiple hosts and schemes.
|
Mux can handle requests for multiple hosts and paths.
|
||||||
|
|
||||||
mux := &gemini.Mux{}
|
mux := &gemini.Mux{}
|
||||||
mux.HandleFunc("example.com", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
mux.HandleFunc("example.com", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
@ -39,8 +39,8 @@ Mux can handle requests for multiple hosts and schemes.
|
|||||||
mux.HandleFunc("example.org/about.gmi", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
mux.HandleFunc("example.org/about.gmi", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
fmt.Fprint(w, "About example.org")
|
fmt.Fprint(w, "About example.org")
|
||||||
})
|
})
|
||||||
mux.HandleFunc("http://example.net", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
mux.HandleFunc("/images/", func(ctx context.Context, w gemini.ResponseWriter, r *gemini.Request) {
|
||||||
fmt.Fprint(w, "Proxied content from http://example.net")
|
w.WriteHeader(gemini.StatusGone, "Gone forever")
|
||||||
})
|
})
|
||||||
server.Handler = mux
|
server.Handler = mux
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user