Skip to content

v0.13.0

Choose a tag to compare

@floatdrop floatdrop released this 06 Sep 17:50
· 7 commits to main since this release
7864772

One route, one line. go doc -all against 0.12.0 leaves di untouched and
adds dihttp.Handle; nothing changes shape or behaviour, and an upgrade
cannot break a caller.

Added

  • dihttp.Handle(method) makes an http.Handler that resolves a handler
    type from the request's scope and calls one of its methods, named by a
    method expression: mux.Handle("GET /users/{id}", dihttp.Handle((*Users).Show)).
    One type per resource with a method per route replaces a type, a
    registration and a closure per route. The type is Scoped when it needs
    the request and a plain singleton when it does not; Handle follows
    either. Nothing existing changes; an upgrade cannot break a caller.