https://github.com/apachecn-archive/yee

https://github.com/apachecn-archive/yee

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.0%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: apachecn-archive
  • License: mit
  • Language: Go
  • Default Branch: master
  • Size: 5.42 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 3 years ago · Last pushed about 3 years ago
Metadata Files
Readme License

README.md

Yee

 

🦄 Web frameworks for Go, easier & faster.

This is a framework for learning purposes. Refer to the code for Echo and Gin

  • Faster HTTP router
  • Build RESTful APIs
  • Group APIs
  • Extensible middleware framework
  • Define middleware at root, group or route level
  • Data binding for URI Query, JSON, XML, Protocol Buffer3 and form payload
  • HTTP/2(H2C)/Http3(QUIC) support

Supported Go versions

Yee is available as a Go module. You need to use Go 1.13 +

Example

Quick start

```go file, err := os.OpenFile("logrus.log", os.OCREATE|os.OWRONLY|os.O_APPEND, 0666)

if err != nil {
    return
}

y := yee.New()

y.SetLogLevel(logger.Warning)

y.SetLogOut(file)

y.Use(Logger())

y.Static("/assets", "dist/assets")

y.GET("/", func(c yee.Context) (err error) {
    return c.HTMLTml(http.StatusOK, "dist/index.html")
})

y.GET("/hello", func(c yee.Context) error {
    return c.String(http.StatusOK, "<h1>Hello Gee</h1>")
})

y.POST("/test", func(c yee.Context) (err error) {
    u := new(p)
    if err := c.Bind(u); err != nil {
        return c.JSON(http.StatusOK, err.Error())
    }
    return c.JSON(http.StatusOK, u.Test)
})

    y.Run(":9000")

```

API

Provide GET POST PUT DELETE HEAD OPTIONS TRACE PATCH

```go

y := yee.New()

y.GET("/someGet", handler) y.POST("/somePost", handler) y.PUT("/somePut", handler) y.DELETE("/someDelete", handler) y.PATCH("/somePatch", handler) y.HEAD("/someHead", handler) y.OPTIONS("/someOptions", handler)

y.Run(":8000")

```

Restful

You can use Any & Restful method to implement your restful api

  • Any

```go y := yee.New()

y.Any("/any", handler)

y.Run(":8000")

// All request methods for the same URL use the same handler

```

  • Restful

```go

func userUpdate(c Context) (err error) { return c.String(http.StatusOK, "updated") }

func userFetch(c Context) (err error) { return c.String(http.StatusOK, "get it") }

func RestfulApi() yee.RestfulApi { return RestfulApi{ Get: userFetch, Post: userUpdate, } }

y := New()

y.Restful("/", testRestfulApi())

y.Run(":8000")

// All request methods for the same URL use the different handler

```

Middleware

  • basic auth
  • cors
  • crfs
  • gzip
  • jwt
  • logger
  • rate limit
  • recovery
  • secure
  • request id

Benchmark

Resource - CPU: i7-9750H - Memory: 16G - OS: macOS 10.15.5

Date: 2020/06/17

License

MIT

Owner

  • Name: ApacheCN 归档
  • Login: apachecn-archive
  • Kind: organization
  • Email: wizard.z@qq.com

防止重要项目丢失而设立的归档

GitHub Events

Total
Last Year

Dependencies

go.mod go
  • github.com/HdrHistogram/hdrhistogram-go v1.1.2
  • github.com/golang-jwt/jwt v3.2.2+incompatible
  • github.com/golang/protobuf v1.5.2
  • github.com/google/uuid v1.1.1
  • github.com/lucas-clemente/quic-go v0.28.1
  • github.com/mattn/go-colorable v0.1.6
  • github.com/mattn/go-isatty v0.0.14
  • github.com/opentracing/opentracing-go v1.2.0
  • github.com/stretchr/testify v1.7.0
  • github.com/uber/jaeger-client-go v2.30.0+incompatible
  • github.com/uber/jaeger-lib v2.4.1+incompatible
  • github.com/valyala/fasttemplate v1.1.0
  • go.uber.org/atomic v1.9.0
  • golang.org/x/net v0.7.0
  • google.golang.org/protobuf v1.26.0
go.sum go
  • 322 dependencies