funcmain() { helloAPI.ConsolePrint() e := echo.New() e.GET("/", helloAPI.HelloKHighness) e.Logger.Fatal(e.Start(":3333")) }
安装依赖
1 2 3 4 5 6 7 8 9 10 11
$ go mod tidy go: finding module for package github.com/labstack/echo go: found github.com/labstack/echoin github.com/labstack/echo v3.3.10+incompatible go: finding module for package github.com/stretchr/testify/assert go: finding module for package github.com/labstack/gommon/color go: finding module for package github.com/labstack/gommon/log go: finding module for package golang.org/x/crypto/acme/autocert go: found github.com/labstack/gommon/color in github.com/labstack/gommon v0.3.0 go: found github.com/labstack/gommon/log in github.com/labstack/gommon v0.3.0 go: found golang.org/x/crypto/acme/autocert in golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc go: found github.com/stretchr/testify/assert in github.com/stretchr/testify v1.7.0
____ __ / __/___/ / ___ / _// __/ _ \/ _ \ /___/\__/_//_/\___/ v3.3.10-dev High performance, minimalist Go web framework https://echo.labstack.com ____________________________________O/_______ O\ ⇨ http server started on [::]:3333
项目测试
1 2
$curl-X GET http://127.0.0.1:3333 "Hello KHighness!"