{"id":17207112,"url":"https://github.com/aofei/r2","last_synced_at":"2025-04-13T22:12:48.584Z","repository":{"id":52340611,"uuid":"414485421","full_name":"aofei/r2","owner":"aofei","description":"A minimalist HTTP request routing helper for Go.","archived":false,"fork":false,"pushed_at":"2022-08-04T09:08:18.000Z","size":146,"stargazers_count":34,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T22:12:43.052Z","etag":null,"topics":["go","helper","http","minimalist","r2","request","routing"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/aofei/r2","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aofei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-07T06:24:47.000Z","updated_at":"2023-06-19T04:25:07.000Z","dependencies_parsed_at":"2022-09-13T17:00:31.250Z","dependency_job_id":null,"html_url":"https://github.com/aofei/r2","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fr2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fr2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fr2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aofei%2Fr2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aofei","download_url":"https://codeload.github.com/aofei/r2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788915,"owners_count":21161728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","helper","http","minimalist","r2","request","routing"],"created_at":"2024-10-15T02:44:40.254Z","updated_at":"2025-04-13T22:12:48.563Z","avatar_url":"https://github.com/aofei.png","language":"Go","readme":"# R2\n\n[![GitHub Actions](https://github.com/aofei/r2/workflows/Test/badge.svg)](https://github.com/aofei/r2)\n[![codecov](https://codecov.io/gh/aofei/r2/branch/master/graph/badge.svg)](https://codecov.io/gh/aofei/r2)\n[![Go Report Card](https://goreportcard.com/badge/github.com/aofei/r2)](https://goreportcard.com/report/github.com/aofei/r2)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/aofei/r2)](https://pkg.go.dev/github.com/aofei/r2)\n\nA minimalist HTTP request routing helper for Go.\n\nThe name \"R2\" stands for \"Request Routing\". That's all, R2 is just a capable\nlittle helper for HTTP request routing, not another fancy web framework that\nwraps [net/http](https://pkg.go.dev/net/http).\n\nR2 is built for people who:\n\n* Think [net/http](https://pkg.go.dev/net/http) is powerful enough and easy to use.\n* Don't want to use any web framework that wraps [net/http](https://pkg.go.dev/net/http).\n* Don't want to use any variant of [`http.Handler`](https://pkg.go.dev/net/http#Handler).\n* Want [`http.ServeMux`](https://pkg.go.dev/net/http#ServeMux) to have better performance and support path parameters.\n\n## Features\n\n* Extremely easy to use\n* Blazing fast (see [benchmarks](https://github.com/aofei/go-http-request-routing-benchmark#readme))\n* Based on [radix tree](https://en.wikipedia.org/wiki/Radix_tree)\n* Sub-router support\n* Path parameter support\n* No [`http.Handler`](https://pkg.go.dev/net/http#Handler) variant\n* Middleware support\n* Zero third-party dependencies\n* 100% code coverage\n\n## Installation\n\nOpen your terminal and execute\n\n```bash\n$ go get github.com/aofei/r2\n```\n\ndone.\n\n\u003e The only requirement is the [Go](https://go.dev), at least v1.13.\n\n## Hello, 世界\n\nCreate a file named `hello.go`\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\n\t\"github.com/aofei/r2\"\n)\n\nfunc main() {\n\tr := \u0026r2.Router{}\n\tr.Handle(\"\", \"/hello/:name\", http.HandlerFunc(hello))\n\thttp.ListenAndServe(\"localhost:8080\", r)\n}\n\nfunc hello(rw http.ResponseWriter, req *http.Request) {\n\tfmt.Fprintf(rw, \"Hello, %s\\n\", r2.PathParam(req, \"name\"))\n}\n```\n\nand run it\n\n```bash\n$ go run hello.go\n```\n\nthen visit `http://localhost:8080/hello/世界`.\n\n## Community\n\nIf you want to discuss R2, or ask questions about it, simply post questions or\nideas [here](https://github.com/aofei/r2/issues).\n\n## Contributing\n\nIf you want to help build R2, simply follow\n[this](https://github.com/aofei/r2/wiki/Contributing) to send pull requests\n[here](https://github.com/aofei/r2/pulls).\n\n## License\n\nThis project is licensed under the MIT License.\n\nLicense can be found [here](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faofei%2Fr2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faofei%2Fr2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faofei%2Fr2/lists"}