mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
feat: add endpoint compatible to github readme stats (resolve #65)
This commit is contained in:
@@ -27,11 +27,12 @@ func NewStatsHandler(userService services.IUserService, summaryService services.
|
||||
}
|
||||
|
||||
func (h *StatsHandler) RegisterRoutes(router *mux.Router) {
|
||||
r := router.PathPrefix("/wakatime/v1/users/{user}/stats/{range}").Subrouter()
|
||||
r := router.PathPrefix("").Subrouter()
|
||||
r.Use(
|
||||
middlewares.NewAuthenticateMiddleware(h.userSrvc).WithOptionalFor([]string{"/"}).Handler,
|
||||
)
|
||||
r.Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
r.Path("/v1/users/{user}/stats/{range}").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
r.Path("/compat/wakatime/v1/users/{user}/stats/{range}").Methods(http.MethodGet).HandlerFunc(h.Get)
|
||||
}
|
||||
|
||||
// TODO: support filtering (requires https://github.com/muety/wakapi/issues/108)
|
||||
|
||||
Reference in New Issue
Block a user