mirror of
https://gitea.com/action-examples/Go.git
synced 2026-03-27 08:30:06 +00:00
- Remove the import statement for "github.com/gin-gonic/gin" in main.go - Add a new file called router.go in the router directory - Create a new function called New() in router.go that returns a *gin.Engine - Add a GET route for "/ping" in the New() function in router.go Signed-off-by: appleboy <appleboy.tw@gmail.com>
14 lines
196 B
Go
14 lines
196 B
Go
package main
|
|
|
|
import (
|
|
"example/router"
|
|
)
|
|
|
|
func main() {
|
|
r := router.New()
|
|
// listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
|
|
if err := r.Run(); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|