Made use of httpr.Router.Sub() functionality.
This commit is contained in:
parent
6fe6c856cd
commit
a6bec0db75
@ -96,27 +96,30 @@ func main() {
|
||||
|
||||
captchaApi := dwhttp.NewCaptchaApiHandlers(*captchaExpiry)
|
||||
|
||||
r.Handler(http.MethodPost, "/api/captcha", captchaApi.New)
|
||||
r.Handler(http.MethodPost, "/api/captcha/:id", captchaApi.Solve)
|
||||
r.Handler(http.MethodGet, "/api/captcha/:id/image", captchaApi.Image)
|
||||
s := r.Sub("/api/captcha")
|
||||
s.Handler(http.MethodPost, "/", captchaApi.New)
|
||||
s.Handler(http.MethodPost, "/:id", captchaApi.Solve)
|
||||
s.Handler(http.MethodGet, "/:id/image", captchaApi.Image)
|
||||
|
||||
guestbookApi := dwhttp.NewGuestbookApiHandlers(*guestbookOwner, *guestbookPageSize, guestbookDB)
|
||||
|
||||
r.Handler(http.MethodPost, "/api/guestbook", guestbookApi.New)
|
||||
r.Handler(http.MethodPatch, "/api/guestbook/:id", guestbookApi.Edit)
|
||||
r.Handler(http.MethodDelete, "/api/guestbook/:id", guestbookApi.Delete)
|
||||
r.Handler(http.MethodPost, "/api/guestbook/:id/reply", guestbookApi.Reply)
|
||||
r.Handler(http.MethodPatch, "/api/guestbook/:id/reply", guestbookApi.EditReply)
|
||||
r.Handler(http.MethodDelete, "/api/guestbook/:id/reply", guestbookApi.DeleteReply)
|
||||
s = r.Sub("/api/guestbook")
|
||||
s.Handler(http.MethodPost, "/", guestbookApi.New)
|
||||
s.Handler(http.MethodPatch, "/:id", guestbookApi.Edit)
|
||||
s.Handler(http.MethodDelete, "/:id", guestbookApi.Delete)
|
||||
s.Handler(http.MethodPost, "/:id/reply", guestbookApi.Reply)
|
||||
s.Handler(http.MethodPatch, "/:id/reply", guestbookApi.EditReply)
|
||||
s.Handler(http.MethodDelete, "/:id/reply", guestbookApi.DeleteReply)
|
||||
|
||||
mindflowApi := dwhttp.NewMindflowApiHandlers(mindflowDB)
|
||||
|
||||
r.Handler(http.MethodPost, "/api/mindflow", mindflowApi.NewPost)
|
||||
r.Handler(http.MethodPatch, "/api/mindflow/:id", mindflowApi.EditPost)
|
||||
r.Handler(http.MethodDelete, "/api/mindflow/:id", mindflowApi.DeletePost)
|
||||
r.Handler(http.MethodPost, "/api/mindflow/category", mindflowApi.NewCategory)
|
||||
r.Handler(http.MethodPatch, "/api/mindflow/category/:id", mindflowApi.EditCategory)
|
||||
r.Handler(http.MethodDelete, "/api/mindflow/category/:id", mindflowApi.DeleteCategory)
|
||||
s = r.Sub("/api/mindflow")
|
||||
s.Handler(http.MethodPost, "/", mindflowApi.NewPost)
|
||||
s.Handler(http.MethodPatch, "/:id", mindflowApi.EditPost)
|
||||
s.Handler(http.MethodDelete, "/:id", mindflowApi.DeletePost)
|
||||
s.Handler(http.MethodPost, "/category", mindflowApi.NewCategory)
|
||||
s.Handler(http.MethodPatch, "/category/:id", mindflowApi.EditCategory)
|
||||
s.Handler(http.MethodDelete, "/category/:id", mindflowApi.DeleteCategory)
|
||||
|
||||
srv := dwhttp.NewHttpServer(r)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user