This commit is contained in:
2023-04-15 18:20:06 +07:00
parent 2ed6c81827
commit 4ba1f9aeac
4 changed files with 18 additions and 16 deletions

View File

@ -20,16 +20,16 @@ func NewServer(listenAddr string) *Server {
func (s *Server) Start() error {
gin.SetMode(gin.ReleaseMode)
r := gin.Default()
SetupRoutes(r)
s.SetupRoutes(r)
fmt.Println("Server is running on port:", config.HTTPPort)
err := r.Run(":" + config.HTTPPort)
err := r.Run(s.listenAddr)
if err != nil {
return err
}
return nil
}
func SetupRoutes(app *gin.Engine) {
func (s *Server) SetupRoutes(app *gin.Engine) {
api := app.Group("/api")
v1 := api.Group("/v1")