1
0
mirror of https://github.com/go-kratos/kratos.git synced 2026-05-22 10:15:24 +02:00

examples: fix dir structure (#768)

* fix dir structure
This commit is contained in:
Tony Chen
2021-03-15 17:10:32 +08:00
committed by GitHub
parent 74272546ca
commit 5a8acec808
7 changed files with 22 additions and 20 deletions
+28
View File
@@ -0,0 +1,28 @@
package main
import (
"log"
"github.com/gin-gonic/gin"
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/transport/http"
)
func main() {
router := gin.Default()
router.GET("/home", func(ctx *gin.Context) {
ctx.String(200, "Hello Gin!")
})
httpSrv := http.NewServer(http.Address(":8000"))
httpSrv.HandlePrefix("/", router)
app := kratos.New(
kratos.Name("gin"),
kratos.Server(
httpSrv,
),
)
if err := app.Run(); err != nil {
log.Println(err)
}
}