Example #1
0
// HTTP服务执行入口
func (s *Server) ServeHTTP(r engine.Request, w engine.Response) {
	var h *echo.Echo
	app, ok := s.Apps[r.Host()]
	if !ok || app.Handler == nil {
		h = s.Core
	} else {
		h = app.Handler
	}

	if h != nil {
		h.ServeHTTP(r, w)
	} else {
		w.NotFound()
	}
}
Example #2
0
// Wrap adds several routes from package `net/http/pprof` to *gin.Engine object
func Wrap(router *echo.Echo) {
	router.Get("/debug/pprof/", IndexHandler())
	router.Get("/debug/pprof/heap", HeapHandler())
	router.Get("/debug/pprof/goroutine", GoroutineHandler())
	router.Get("/debug/pprof/block", BlockHandler())
	router.Get("/debug/pprof/threadcreate", ThreadCreateHandler())
	router.Get("/debug/pprof/cmdline", CmdlineHandler())
	router.Get("/debug/pprof/profile", ProfileHandler())
	router.Get("/debug/pprof/symbol", SymbolHandler())
	router.Get("/debug/pprof/trace", TraceHandler())
}