Ejemplo n.º 1
0
func SetRoute(router *mux.Router, path, name, method string, handlerFunc func(w http.ResponseWriter, r *http.Request)) *mux.Router {
	var handler http.HandlerFunc

	handler = handlerFunc
	handler = logger.Logger(handler, name)
	router.HandleFunc(path, handler).Methods(method)

	return router
}
Ejemplo n.º 2
0
func SetProtectedRoute(router *mux.Router, path, name, method string, handlerFunc func(w http.ResponseWriter, r *http.Request)) *mux.Router {
	var handler http.HandlerFunc

	handler = handlerFunc
	handler = jwt.JWTTokenAuthentication(handler)
	handler = logger.Logger(handler, name)
	router.HandleFunc(path, handler).Methods(method)

	return router
}