You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
501 B
29 lines
501 B
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/go-kratos/kratos/v2"
|
|
"github.com/go-kratos/kratos/v2/transport/http"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func main() {
|
|
router := echo.New()
|
|
router.GET("/home", func(ctx echo.Context) error {
|
|
return ctx.JSON(200, "Hello echo")
|
|
})
|
|
|
|
httpSrv := http.NewServer(http.Address(":8000"))
|
|
httpSrv.HandlePrefix("/", router)
|
|
|
|
app := kratos.New(
|
|
kratos.Name("echo"),
|
|
kratos.Server(
|
|
httpSrv,
|
|
),
|
|
)
|
|
if err := app.Run(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
|