File tree Expand file tree Collapse file tree 5 files changed +47
-0
lines changed Expand file tree Collapse file tree 5 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -2123,6 +2123,7 @@ func main() {
21232123< details>
21242124< summary> Web 框架< /summary>
21252125
2126+ - [mux](https://github.com/gorilla/mux): 一个强大的URL路由器和golang调度程序。
21262127- [Iris](https://github.com/kataras/iris): 一个快速,简单但功能齐全且非常高效的Web框架。
21272128- [gin](https://github.com/gin-gonic/gin): HTTP Web框架,它具有类似Martini的API,具有更好的性能
21282129- [Macaron](https://go-macaron.com/): 模块化 Web 框架
Original file line number Diff line number Diff line change 1+
2+
3+ ``` bash
4+ go list -m all
5+ go install
6+ go clean -modcache
7+ ```
Original file line number Diff line number Diff line change 1+ module " https://github.com/gin-gonic/gin.git"
2+
3+ require (
4+ github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect
5+ github.com/gin-gonic/gin v1.3.0
6+ github.com/golang/protobuf v1.2.0 // indirect
7+ github.com/mattn/go-isatty v0.0.4 // indirect
8+ github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect
9+ gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
10+ gopkg.in/yaml.v2 v2.2.2 // indirect
11+ )
Original file line number Diff line number Diff line change 1+ github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 h1:AzN37oI0cOS+cougNAV9szl6CVoj2RYwzS3DpUQNtlY =
2+ github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 /go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s =
3+ github.com/gin-gonic/gin v1.3.0 h1:kCmZyPklC0gVdL728E6Aj20uYBJV93nj/TkwBTKhFbs =
4+ github.com/gin-gonic/gin v1.3.0 /go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y =
5+ github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM =
6+ github.com/golang/protobuf v1.2.0 /go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U =
7+ github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs =
8+ github.com/mattn/go-isatty v0.0.4 /go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4 =
9+ github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 h1:EICbibRW4JNKMcY+LsWmuwob+CRS1BmdRdjphAm9mH4 =
10+ github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 /go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0 =
11+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
12+ gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ =
13+ gopkg.in/go-playground/validator.v8 v8.18.2 /go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y =
14+ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw =
15+ gopkg.in/yaml.v2 v2.2.2 /go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI =
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import "github.com/gin-gonic/gin"
4+
5+ func main () {
6+ r := gin .Default ()
7+ r .GET ("/ping" , func (c * gin.Context ) {
8+ c .JSON (200 , gin.H {
9+ "message" : "pong" ,
10+ })
11+ })
12+ r .Run (":8089" ) // listen and serve on 0.0.0.0:8080
13+ }
You can’t perform that action at this time.
0 commit comments