server.go 606 B

123456789101112131415161718192021222324252627282930313233
  1. package web
  2. import (
  3. "git.sfnt.net/sfnt/cnlink/web/api"
  4. "github.com/gin-gonic/gin"
  5. )
  6. func Start() {
  7. r := gin.Default()
  8. //r.LoadHTMLGlob("views/*")
  9. r.LoadHTMLGlob("views/**/*")
  10. r.GET("/", func(c *gin.Context) {
  11. c.JSON(200, gin.H{
  12. "message": "home page",
  13. })
  14. })
  15. r.GET("/ver", api.CheckVersion)
  16. r.GET("/health", api.CheckHealth)
  17. /*
  18. r.GET("/create", func(c *gin.Context) {
  19. c.JSON(200, gin.H{
  20. "message": "create page",
  21. })
  22. })
  23. */
  24. r.GET("/u:sid", func(c *gin.Context) {
  25. c.JSON(200, gin.H{
  26. "message": c.Params.ByName("sid"),
  27. })
  28. //c.Redirect(http.StatusFound,"")
  29. })
  30. r.Run()
  31. }