Skip to content

Releases: bmf-san/goblin

2.0.0

05 May 04:44
c2a4f13
Compare
Choose a tag to compare

Support middlewares 🎉

  • Supported middlewares
  • Refactored a part of router
  • Added description of middleware to README.md

Upgrade guide

This version is not backwards compatible and needs to be addressed when updating.

So you need to change the DSL for the routing definition as follows:

r.GET(`/`, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "/")
}))
r.GET(`/`).Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, `/`)
}))

Major changes

New chain methods called Handler and Use have been added.

Handler is required, but Use is not.

If you want to use middleware, you can set it by using Use.

func first(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "first: before\n")
		next.ServeHTTP(w, r)
		fmt.Fprintf(w, "first: after\n")
	})
}

r.GET(`/`).Use(first).Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, `/`)
}))

The signature of the method with the same name as the HTTP verb(GET, POST, PUT, PATCH, DELETE, OPTION) has changed.

Before:

GET(path string, handler http.Handler) 

After:

GET(path string)

See the README.md and _examples for more specific information.

What's Changed

Full Changelog: 1.2.2...2.0.0

1.2.2

11 Apr 15:43
18a609d
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.2.1...1.2.2

1.2.1

21 Feb 13:25
fce2974
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.2.0...1.2.1

1.2.0

21 Feb 13:03
5a8d7e0
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.1.2...1.2.0

1.1.2

04 Feb 13:38
4861631
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.1.1...1.1.2

1.1.1

28 Dec 07:38
78aa557
Compare
Choose a tag to compare

What's Changed

  • Minor fix in readme. by @bmf-san in #23
  • Fix typo in comments and error messages, code block language in README by @rinchsan in #24

New Contributors

Full Changelog: 1.1.0...1.1.1

1.1.0

12 Aug 05:18
4ca3dc2
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.0.6...1.1.0

1.0.6

27 Jul 14:34
677fa7e
Compare
Choose a tag to compare

What's Changed

  • How about supporting http.Handler instead of just only http.HandlerFunc by @Songmu in #16
  • define type regCache to cache regexp by @Songmu in #17
  • Fix some comments by @bmf-san in #19
  • separate benchmark package to reduce dependency by @Songmu in #18
  • Update benchmark tests and readme by @bmf-san in #20

New Contributors

Full Changelog: 1.0.5...1.0.6

1.0.5

18 Jul 12:49
8b3133b
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.0.4...1.0.5

1.0.4

18 Jul 12:28
4743566
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.0.2...1.0.4