Installation echo frame

Video Address:

https://www.bilibili.com/video/av63492462?p=31

echo document Address:

https://echo.labstack.com/guide/installation

Download echo frame

In the project root directory (D: \ Go \ www \ src \ echo_one) to build a new main.go

package main

import (
   "net/http"
   "github.com/labstack/echo"
)

func main() {
   e := echo.New()
   e.GET("/", func(c echo.Context) error {
      return c.String(http.StatusOK, "Hello, World!")
   })
   e.Logger.Fatal(e.Start(":8001"))
}

In cmd in, cd to the project root directory

D:\Go\www\src\echo_one>set GO111MODULE=on
D:\Go\www\src\echo_one>go mod init
D:\Go\www\src\echo_one>go mod tidy

D:\Go\www\src\echo_one\go.mod里

module echo_one

go 1.12

require (
   github.com/labstack/echo v3.3.10+incompatible
   github.com/labstack/gommon v0.3.0 // indirect
   golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a // indirect
)

replace golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a => github.com/golang/crypto v0.0.0-20191108234033-bd318be0434a // indirect

And then re-execute the command in cmd

D:\Go\www\src\echo_one>go mod download

At this point the echo has been installed

cmd in the Start running about

D:\Go\www\src\echo_one>go run main.go

   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v3.3.10-dev
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:8001

or:

D:\Go\www\src\echo_one>bee run
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.10.0
2019/11/10 19:44:12 INFO     ▶ 0001 Using 'echo_one' as 'appname'
2019/11/10 19:44:12 INFO     ▶ 0002 Initializing watcher...
2019/11/10 19:44:19 SUCCESS  ▶ 0003 Built Successfully!
2019/11/10 19:44:19 INFO     ▶ 0004 Restarting 'echo_one.exe'...
2019/11/10 19:44:19 SUCCESS  ▶ 0005 './echo_one.exe' is running...

   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v3.3.10-dev
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
⇨ http server started on [::]:8001

Access it

http://localhost:8001/

Hello, World!

Guess you like

Origin www.cnblogs.com/haima/p/11831486.html