示例#1
0
文件: server.go 项目: htee/hteed
func (s *server) ServerHandler() http.Handler {
	n := negroni.New()
	n.Use(negroni.HandlerFunc(s.upstreamMiddleware))
	n.Use(negroni.HandlerFunc(s.fixRailsVerbMiddleware))

	n.UseHandler(http.HandlerFunc(s.handleRequest))

	return n
}
示例#2
0
文件: server.go 项目: htee/htee
func ServerHandler() http.Handler {
	s := &server{
		transport: &http.Transport{
			ResponseHeaderTimeout: 15 * time.Second,
		},
		upstream: upstream,
		logger:   log.New(os.Stdout, "[server] ", log.LstdFlags),
	}

	n := negroni.New()
	n.Use(negroni.HandlerFunc(s.upstreamMiddleware))
	n.Use(negroni.HandlerFunc(s.fixRailsVerbMiddleware))

	n.UseHandler(http.HandlerFunc(s.handleRequest))

	return n
}