NotFoundHandler in Go
NotFoundHandler returns a simple request handler that replies to each request with a “404 page not found” reply.
package main
import (
"log"
"net/http"
)
func main() {
mux := http.NewServeMux()
// Create sample handler to returns 404
mux.Handle("/resources", http.NotFoundHandler())
// Create sample handler that returns 200
mux.Handle("/resources/people/", newPeopleHandler())
log.Fatal(http.ListenAndServe(":8080", mux))
}