router.go 338 B

1234567891011121314151617181920
  1. package routers
  2. import (
  3. "duoduo/apis/pdd"
  4. "github.com/gin-gonic/gin"
  5. "net/http"
  6. )
  7. func InitRouter() {
  8. r := gin.New()
  9. r.GET("/", func(c *gin.Context) { c.String(http.StatusOK, "hello!") })
  10. r.GET("/root.txt", func(c *gin.Context) { c.File("./root.txt") })
  11. r2 := r.Group("/")
  12. {
  13. pdd.InitPddDdkRouter(r2)
  14. }
  15. _ = r.Run(":80")
  16. }