方法 1
http.HandleFunc("/", indexHandler)
err := http.ListenAndServe(":8880", nil)
方法 2
//httprouter
router := httprouter.New()
router.GET("/", Index)
router.POST("/adduser/:uid", adduser)
log.Fatal(http.ListenAndServe(":8080", router))
方法 3
//gin
router := gin.Default()
router.GET("/",getting)
router.POST("/",posting)
router.Run()
有疑问加站长微信联系(非本文作者)