Exemplo n.º 1
0
// JSONEndpoints is a listing of all endpoints available in the SimpleService.
func (s *SimpleService) Endpoints() map[string]map[string]http.HandlerFunc {
	return map[string]map[string]http.HandlerFunc{
		"/most-popular/{resourceType}/{section}/{timeframe}": map[string]http.HandlerFunc{
			"GET": server.JSONToHTTP(s.GetMostPopular).ServeHTTP,
		},
		"/cats": map[string]http.HandlerFunc{
			"GET": s.GetCats,
		},
	}
}
Exemplo n.º 2
0
// Endpoints returns the two endpoints for our stream service.
func (s *StreamService) Endpoints() map[string]map[string]http.HandlerFunc {
	return map[string]map[string]http.HandlerFunc{
		"/create": map[string]http.HandlerFunc{
			"GET": server.JSONToHTTP(s.CreateStream).ServeHTTP,
		},
		"/stream/{stream_id:[0-9]+}": map[string]http.HandlerFunc{
			"GET": s.Stream,
		},
		"/demo/{stream_id:[0-9]+}": map[string]http.HandlerFunc{
			"GET": s.Demo,
		},
	}
}