Reformat http
This commit is contained in:
parent
308ff98830
commit
0f1bd4cac3
13
http/http.go
13
http/http.go
@ -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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user