Skip to content

Instantly share code, notes, and snippets.

@kyokomi
Created September 10, 2019 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyokomi/28f05540ea4fd3964927282ff619ed8e to your computer and use it in GitHub Desktop.
Save kyokomi/28f05540ea4fd3964927282ff619ed8e to your computer and use it in GitHub Desktop.
gzipGroup := e.Group("", stdMiddleware.Gzip())
authV1API := gzipGroup.Group("/v1", middleware.FirebaseHandler)
{
// login
authV1API.POST("/login", ctl.PostLogin)
// user
authV1API.GET("/user/me", ctl.GetUserMe)
authV1API.PATCH("/user/me", ctl.PatchUserMe)
authV1API.DELETE("/user/me", ctl.DeleteUserMe)
// article
authV1API.GET("/article/own", ctl.Article.GetOwn)
authV1API.POST("/articles", ctl.Article.Creation)
authV1API.PATCH("/articles/:id/edit", ctl.Article.Update)
authV1API.DELETE("/articles/:id", ctl.Article.Delete)
}
notAuthV1API := gzipGroup.Group("/v1")
{
// user
notAuthV1API.GET("/users/:id", ctl.GetOtherUser)
// article
notAuthV1API.GET("/articles", ctl.Article.GetByCount)
notAuthV1API.GET("/articles/:id", ctl.Article.Get)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment