1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2025-08-21 22:29:55 +02:00

examples: Use Server.Handler

This commit is contained in:
adnano 2021-02-17 20:35:27 -05:00
parent 4d2b18a7a7
commit cbeb7de98e
3 changed files with 7 additions and 4 deletions

@ -42,7 +42,7 @@ func main() {
Duration: time.Hour,
})
}
server.Handle("localhost", &mux)
server.Handler = &mux
if err := server.ListenAndServe(); err != nil {
log.Fatal(err)

@ -33,9 +33,9 @@ func main() {
}
var mux gemini.ServeMux
mux.Handle("/", gemini.FileServer(os.DirFS("/var/www")))
mux.Handle("localhost", gemini.FileServer(os.DirFS("/var/www")))
server.Handler = &mux
server.Handle("localhost", &mux)
if err := server.ListenAndServe(); err != nil {
log.Fatal(err)
}

@ -31,7 +31,10 @@ func main() {
})
}
server.HandleFunc("localhost", stream)
var mux gemini.ServeMux
mux.HandleFunc("/", stream)
server.Handler = &mux
if err := server.ListenAndServe(); err != nil {
log.Fatal(err)
}