package main import ( "tugas1/controllers" "tugas1/initializers" "tugas1/middleware" "github.com/gin-gonic/gin" ) func init() { initializers.LoadEnvVariables() initializers.ConnectToDB() initializers.SyncDatabase() } func main() { r := gin.Default() r.POST("/posts", controllers.PostsCreate) r.PUT("/posts/:id", controllers.PostsUpdate) r.GET("/posts", controllers.PostsIndex) r.GET("/posts/:id", controllers.PostsShow) r.DELETE("/posts/:id", controllers.PostsDelete) r.POST("/signup", controllers.SignUp) r.POST("/login", controllers.Login) r.GET("/validate", middleware.RequireAuth, controllers.Validate) r.Run() }