Reformat http

This commit is contained in:
Jan Bader 2016-12-20 09:46:39 +01:00
parent 308ff98830
commit 0f1bd4cac3

View File

@ -20,6 +20,7 @@ const (
authCookie = "authentication" authCookie = "authentication"
) )
// Serve starts the HTTP Server
func (h *Handler) Serve() { func (h *Handler) Serve() {
router := gin.Default() router := gin.Default()
@ -31,18 +32,12 @@ func (h *Handler) Serve() {
api := router.Group("/api/v1") api := router.Group("/api/v1")
{ {
api.GET("/logout", logout) api.GET("/logout", logout)
api.GET("/login", func(c *gin.Context) { api.GET("/login", func(c *gin.Context) { c.Redirect(http.StatusPermanentRedirect, "/login") })
c.Redirect(http.StatusPermanentRedirect, "/login")
})
api.POST("/login", h.loginPost) api.POST("/login", h.loginPost)
// Unauthenticated routes // Unauthenticated routes
api.GET("/check", func(c *gin.Context) { api.GET("/check", func(c *gin.Context) { c.String(http.StatusOK, "Accessible") })
c.String(http.StatusOK, "Accessible") api.GET("/hello", func(c *gin.Context) { c.String(http.StatusOK, "Hello, World!") })
})
api.GET("/hello", func(c *gin.Context) {
c.String(http.StatusOK, "Hello, World!")
})
// Restricted group // Restricted group
r := api.Group("/restricted") r := api.Group("/restricted")