예제 #1
0
파일: handlers.go 프로젝트: 2722/lantern
func registerHandlers(pres *godoc.Presentation) {
	if pres == nil {
		panic("nil Presentation")
	}
	http.HandleFunc("/doc/codewalk/", codewalk)
	http.Handle("/doc/play/", pres.FileServer())
	http.Handle("/robots.txt", pres.FileServer())
	http.Handle("/", pres)
	http.Handle("/pkg/C/", redirect.Handler("/cmd/cgo/"))
	redirect.Register(nil)
}
예제 #2
0
파일: handlers.go 프로젝트: jehiah/tools
func registerHandlers(pres *godoc.Presentation) *http.ServeMux {
	if pres == nil {
		panic("nil Presentation")
	}
	mux := http.NewServeMux()
	mux.HandleFunc("/doc/codewalk/", codewalk)
	mux.Handle("/doc/play/", pres.FileServer())
	mux.Handle("/robots.txt", pres.FileServer())
	mux.Handle("/", pres)
	mux.Handle("/pkg/C/", redirect.Handler("/cmd/cgo/"))
	redirect.Register(mux)
	http.Handle("/", hostEnforcerHandler{mux})

	return mux
}