Sha256: 819c1f0950fdd63b7542d881cd193f34d43eef58fb40ac24316449875917eb9b

Contents?: true

Size: 715 Bytes

Versions: 15

Compression:

Stored size: 715 Bytes

Contents

package handlers

import (
	"net/http"
	"reflect"

	"github.com/gorilla/pat"
	"<%= namespace %>/<%= application_name %>/logging"
)

type RouterDependenciesContainer struct {
	StatsD logging.StatsD `inject:"statsd"`
}

var RouterDependencies *RouterDependenciesContainer = &RouterDependenciesContainer{}

func GetRouter() *pat.Router {
	r := pat.New()

	r.Get("/v1/health", HealthHandler)

	r.Add("POST", "/v1/echo", requestValidationHandler(
		ECHO_HANDLER+POST,
		reflect.TypeOf(Echo{}),
		RouterDependencies.StatsD,
		http.HandlerFunc(EchoHandler),
	))

	//Add routing for static routes
	s := http.StripPrefix("/swagger/", http.FileServer(http.Dir("/swagger")))
	r.PathPrefix("/swagger/").Handler(s)

	return r
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
minke-generator-go-0.8.7 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.8.6 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.8.5 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.8.4 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.8.3 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.8.2 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.8.1 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.8.0 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.7.2 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.7.1 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.7.0 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.6.0 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.5.0 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.4.0 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb
minke-generator-go-0.1.0 lib/generators/gomicroservice/scaffold/handlers/xx_router.go.erb