package api import ( "net/http" "time" "github.com/gin-gonic/gin" ) func Listen(address string, base string) error { router := gin.Default() api := router.Group(base) auth := api.Group("auth") auth.POST("register", register) auth.POST("login", login) auth.GET("logout", isLoggedIn, logout) server := &http.Server{ Addr: address, Handler: router, ReadTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second, } return server.ListenAndServe() }