MCPcopy Index your code
hub / github.com/cookieY/yee

github.com/cookieY/yee @v0.5.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.3 ↗ · + Follow
473 symbols 1,585 edges 49 files 92 documented · 19% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

    file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY|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


  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
  y := yee.New()

  y.Any("/any", handler)

  y.Run(":8000")

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

  • Restful

  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

Extension points exported contracts — how you extend this code

ResponseWriter (Interface)
ResponseWriter ... [1 implementers]
response_overide.go
Context (Interface)
Context is the default implementation interface of context [1 implementers]
context.go
Logger (Interface)
Logger ... [1 implementers]
logger/log.go
BindUnmarshaler (Interface)
BindUnmarshaler is the interface used to wrap the UnmarshalParam method. Types that don't implement this, but do impleme
bind.go
HandlerFunc (FuncType)
HandlerFunc define handler of context
yee.go
JWTErrorHandler (FuncType)
JWTErrorHandler defines a function which is error for a valid token.
middleware/jwt.go
ProxyTargetHandler (Interface)
(no doc)
middleware/proxy.go
JWTSuccessHandler (FuncType)
JWTSuccessHandler defines a function which is executed for a valid token.
middleware/jwt.go

Core symbols most depended-on inside this repo

String
called by 75
context.go
ServeHTTP
called by 48
yee.go
GET
called by 45
router.go
Get
called by 41
context.go
New
called by 36
yee.go
Error
called by 27
logger/log.go
outer
called by 25
logger/color.go
Request
called by 20
context.go

Shape

Method 243
Function 174
Struct 40
FuncType 7
Interface 5
TypeAlias 4

Languages

Go100%

Modules by API surface

context.go97 symbols
logger/color.go68 symbols
logger/log.go34 symbols
response_overide.go24 symbols
tree.go21 symbols
router.go21 symbols
yee.go18 symbols
test/host.pb.go15 symbols
bind.go14 symbols
router_test.go13 symbols
middleware/trace.go11 symbols
bind_test.go11 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add yee \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact