func (t *Togo) Register(service Service) {
	resources := service.Resources()
	resources = append(resources, Resource{
		Path:   "/hc",
		Method: http.MethodGet,
		Handler: func(w http.ResponseWriter, r *http.Request) {
			if _, err := io.WriteString(w, fmt.Sprintf("ok-%s", t.appName)); err != nil {
				Log.Printf("Unable to write healthcheck response: %s", err)
			}
		},
	})
	for _, resource := range resources {
		t.Router.Handler(resource.Method, resource.SanitizedPath(service.Prefix()), service.Middleware(resource.Handler))
	}
	t.Router.NotFoundHandler(func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(http.StatusMethodNotAllowed)
		if _, err := w.Write(nil); err != nil {
			Log.Printf("Unable to write response for `not found` handler.")
		}
	})
	if t.logFilename != "" {
		logFile(t.logFilename)
	}
	t.server.Handler = Log.Handler(t.Router)
}
// Register adds the specified togo.Service to the Togo server.
Register adds the specified togo.Service to the Togo server.
// Register adds the specified togo . Service to the Togo server .
func (t *Togo) Register(service Service) {
	resources := service.Resources()
	resources = append(resources, Resource{
		Path:   "/hc",
		Method: http.MethodGet,
		Handler: func(w http.ResponseWriter, r *http.Request) {
			if _, err := io.WriteString(w, fmt.Sprintf("ok-%s", t.appName)); err != nil {
				Log.Printf("Unable to write healthcheck response: %s", err)
			}
		},
	})
	for _, resource := range resources {
		t.Router.Handler(resource.Method, resource.SanitizedPath(service.Prefix()), service.Middleware(resource.Handler))
	}
	t.Router.NotFoundHandler(func(w http.ResponseWriter, r *http.Request) {
		w.WriteHeader(http.StatusMethodNotAllowed)
		if _, err := w.Write(nil); err != nil {
			Log.Printf("Unable to write response for `not found` handler.")
		}
	})
	if t.logFilename != "" {
		logFile(t.logFilename)
	}
	t.server.Handler = Log.Handler(t.Router)
}
func ( t * Togo ) Register ( service Service ) { resources := service . Resources ( ) resources = append ( resources , Resource { Path : " " , Method : http . MethodGet , Handler : func ( w http . ResponseWriter , r * http . Request ) { if _ , err := io . WriteString ( w , fmt . Sprintf ( " " , t . appName ) ) ; err != nil { Log . Printf ( " " , err ) } } , } ) for _ , resource := range resources { t . Router . Handler ( resource . Method , resource . SanitizedPath ( service . Prefix ( ) ) , service . Middleware ( resource . Handler ) ) } t . Router . NotFoundHandler ( func ( w http . ResponseWriter , r * http . Request ) { w . WriteHeader ( http . StatusMethodNotAllowed ) if _ , err := w . Write ( nil ) ; err != nil { Log . Printf ( " " ) } } ) if t . logFilename != " " { logFile ( t . logFilename ) } t . server . Handler = Log . Handler ( t . Router ) }
Register adds the specified togo.Service to the Togo server.
Register adds the specified togo . Service to the Togo server .