Planner/apis/base.go
Manuel Forcén Muñoz 54d7d14ef9 Added expenses to plan
2025-04-09 18:37:02 +02:00

28 lines
423 B
Go

package apis
import (
"errors"
"net/http"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
var db *gorm.DB
func BindAPIs(r *gin.Engine, cfg_db *gorm.DB) error {
if cfg_db == nil {
return errors.New("Database is null")
}
db = cfg_db
r.GET("/", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "pong",
})
})
bindPlanAPIs(r)
bindPollAPIs(r)
bindUserAPIs(r)
bindExpensesAPIs(r)
return nil
}