examples: Use Server.Handler

This commit is contained in:
Adnan Maolood 2021-02-17 20:35:27 -05:00
parent 6edde376c4
commit 7475687caa
3 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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)
}

View File

@ -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)
}