Skip to content
/ rewrite Public

pkg rewrite provides the http.ResponseWriter implementation and Replacer of the response.

License

Notifications You must be signed in to change notification settings

Qs-F/rewrite

Repository files navigation

pkg rewrite

pkg rewrite provides the http.ResponseWriter implementation and Replacer of the response.

Installation

go get -u github.com/Qs-F/rewrite

Example

func main() {
  rw := &Rule{
    {
      Old: "world",
      New: "gopher",
    },
  }
  http.Handle("/", rw.MapFunc(func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "hello world")
  }))
  http.ListenAndServe(":8080", nil)
}
// Open localhost:8080, then you will get "hello gopher"

LICENSE

MIT

About

pkg rewrite provides the http.ResponseWriter implementation and Replacer of the response.

Resources

License

Stars

Watchers

Forks

Packages

No packages published