Guest User

Untitled

a guest
May 20th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "./config"
  5. "./controllers"
  6. "github.com/gin-gonic/gin"
  7. _ "github.com/go-sql-driver/mysql"
  8. )
  9.  
  10. func main() {
  11. db := config.DBInit()
  12. inDB := &controllers.InDB{DB: db}
  13.  
  14. router := gin.Default()
  15.  
  16. router.GET("/person/:id", inDB.GetPerson)
  17. router.GET("/persons", inDB.GetPersons)
  18. router.POST("/person", inDB.CreatePerson)
  19. router.PUT("/person", inDB.UpdatePerson)
  20. router.DELETE("/person/:id", inDB.DeletePerson)
  21. router.Run(":3000")
  22. }
Add Comment
Please, Sign In to add comment