You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
639 B

2 years ago
package main
import (
"tugas1/controllers"
"tugas1/initializers"
"tugas1/middleware"
2 years ago
"github.com/gin-gonic/gin"
)
func init() {
initializers.LoadEnvVariables()
initializers.ConnectToDB()
initializers.SyncDatabase()
2 years ago
}
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)
2 years ago
r.Run()
}