URL rewriting for Golang
Go to file
mleku 7340ea4464
fixed to work from new URL
2024-02-25 18:38:50 +00:00
.gitignore fixed to work from new URL 2024-02-25 18:38:50 +00:00
LICENSE Create LICENSE 2020-09-27 21:21:09 +08:00
README.md fixed to work from new URL 2024-02-25 18:38:50 +00:00
go.mod fixed to work from new URL 2024-02-25 18:38:50 +00:00
rewrite.go fixed to work from new URL 2024-02-25 18:38:50 +00:00
rewrite_test.go fixed to work from new URL 2024-02-25 18:38:50 +00:00

README.md

Build Status Badge Go Docs Badge

Rewrite

Golang URL rewriting

Usage

import "mleku.dev/git/rewrite"

// ...

handler := rewrite.NewHandler(map[string]string{
  "/a": "/b",
  "/api/(.*)", "/api/v1/$1",
  "/api/(.*)/actions/(.*)", "/api/v1/$1/actions/$2",
  "/from/:one/to/:two", "/from/:two/to/:one",
})

// ...