func configurePosts(routes *wcg.Router) { routes.Get("/:blog_id/:post_id/", showPostHandler) routes.Post("/admin/blogs/:blog_id/", createPostHandler) routes.Get("/admin/blogs/:blog_id/:post_id/", editPostHandler) routes.Put("/admin/blogs/:blog_id/:post_id/", updatePostHandler) routes.Delete("/admin/blogs/:blog_id/:post_id/", deletePostHandler) }
func configureBlogs(routes *wcg.Router) { // check user is already signed in or not. routes.All("/admin/blogs/*", func(res *wcg.Response, req *wcg.Request) { if wcg.IsGuest(req.User) { res.Redirect("/", http.StatusFound) } }) // public interfaces. routes.Get("/my/", myblogRedirector(true)) routes.Get("/:blog_id/", showBlogHandler) // admin interfaces routes.Get("/admin/blogs/my/", myblogRedirector(false)) routes.Get("/admin/blogs/:blog_id/", manageBlogHandler) routes.Post("/admin/blogs/", createBlogHandler) routes.Put("/admin/blogs/:blog_id/", updateBlogHandler) routes.Delete("/admin/blogs/:blog_id/", deleteBlogHandler) }