package main import "github.com/go-chi/chi/v5" func (a *app) registerBlogRoutes(r chi.Router) { r.Route("/blog", func(r chi.Router) { r.Use(a.blogEditorMiddleware) r.Get("/posts", a.listBlogPosts) r.Post("/posts", a.createBlogPost) r.Get("/posts/{id}", a.getBlogPost) r.Patch("/posts/{id}", a.patchBlogPost) r.Delete("/posts/{id}", a.deleteBlogPost) r.Get("/categories", a.listBlogCategories) r.Post("/categories", a.createBlogCategory) r.Get("/categories/{id}", a.getBlogCategory) r.Patch("/categories/{id}", a.patchBlogCategory) r.Delete("/categories/{id}", a.deleteBlogCategory) r.Get("/tags", a.listBlogTags) r.Post("/tags", a.createBlogTag) r.Get("/tags/{id}", a.getBlogTag) r.Patch("/tags/{id}", a.patchBlogTag) r.Delete("/tags/{id}", a.deleteBlogTag) r.Get("/authors", a.listBlogAuthors) r.Post("/authors", a.createBlogAuthor) r.Get("/authors/{id}", a.getBlogAuthor) r.Patch("/authors/{id}", a.patchBlogAuthor) r.Delete("/authors/{id}", a.deleteBlogAuthor) }) }