1234567891011121314151617181920212223242526272829303132333435363738 |
- package web
- import (
- "git.sfnt.net/sfnt/cnlink/lib"
- "git.sfnt.net/sfnt/cnlink/web/api"
- "github.com/gin-gonic/gin"
- )
- func Start() {
- r := gin.Default()
- //r.LoadHTMLGlob("views/*")
- r.LoadHTMLGlob("views/**/*")
- r.GET("/", func(c *gin.Context) {
- c.JSON(200, gin.H{
- "message": "home page",
- })
- })
- r.GET("/ver", api.CheckVersion)
- r.GET("/health", api.CheckHealth)
- /*
- r.GET("/create", func(c *gin.Context) {
- c.JSON(200, gin.H{
- "message": "create page",
- })
- })
- */
- r.GET("/u:sid", func(c *gin.Context) {
- sid := c.Params.ByName("sid")
- //intSid,_ := strconv.ParseUint(sid,10,64)
- c.JSON(200, gin.H{
- "message": lib.String2Int(sid),
- })
- //c.Redirect(http.StatusFound,"")
- })
- r.Run()
- }
|