add validator
This commit is contained in:
5
main.go
5
main.go
@@ -4,6 +4,7 @@ import (
|
||||
"astra-events/config"
|
||||
"astra-events/handler"
|
||||
"astra-events/model"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"gorm.io/driver/postgres"
|
||||
@@ -38,7 +39,9 @@ func main() {
|
||||
|
||||
db.AutoMigrate(&model.Event{})
|
||||
|
||||
var h = &handler.Handler{DB: db}
|
||||
validate := validator.New()
|
||||
|
||||
var h = &handler.Handler{DB: db, Validator: validate}
|
||||
|
||||
e.POST("/", h.CreateEvent)
|
||||
e.GET("/:id", h.GetEvent)
|
||||
|
||||
Reference in New Issue
Block a user