{"id":26826695,"url":"https://github.com/hslam/rum","last_synced_at":"2025-03-30T11:30:37.708Z","repository":{"id":57564027,"uuid":"314484628","full_name":"hslam/rum","owner":"hslam","description":"Package rum implements an HTTP server. The rum server is compatible with net/http and faster than net/http.","archived":false,"fork":false,"pushed_at":"2023-05-14T09:44:32.000Z","size":50,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-02T20:17:09.480Z","etag":null,"topics":["epoll","fast","go","golang","http","kqueue","netpoll","server"],"latest_commit_sha":null,"homepage":"","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/hslam.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-20T07:57:27.000Z","updated_at":"2024-06-26T17:06:43.000Z","dependencies_parsed_at":"2024-06-20T09:20:37.486Z","dependency_job_id":"e54bae89-e1da-4313-8a19-9932b74ccb67","html_url":"https://github.com/hslam/rum","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Frum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Frum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Frum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Frum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hslam","download_url":"https://codeload.github.com/hslam/rum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246313596,"owners_count":20757446,"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":["epoll","fast","go","golang","http","kqueue","netpoll","server"],"created_at":"2025-03-30T11:30:36.630Z","updated_at":"2025-03-30T11:30:37.680Z","avatar_url":"https://github.com/hslam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rum\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/hslam/rum)](https://pkg.go.dev/github.com/hslam/rum)\n[![Build Status](https://github.com/hslam/rum/workflows/build/badge.svg)](https://github.com/hslam/rum/actions)\n[![codecov](https://codecov.io/gh/hslam/rum/branch/master/graph/badge.svg)](https://codecov.io/gh/hslam/rum)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hslam/rum)](https://goreportcard.com/report/github.com/hslam/rum)\n[![LICENSE](https://img.shields.io/github/license/hslam/rum.svg?style=flat-square)](https://github.com/hslam/rum/blob/master/LICENSE)\n\nPackage rum implements an HTTP server. The rum server is compatible with net/http and faster than net/http.\n\n## Features\n* Fully compatible with the http.HandlerFunc interface.\n* Support other router that implements the http.Handler interface.\n* [Epoll/Kqueue](https://github.com/hslam/netpoll \"netpoll\")\n* [HTTP request](https://github.com/hslam/request \"request\")\n* [HTTP response](https://github.com/hslam/response \"response\")\n* [HTTP request multiplexer](https://github.com/hslam/mux \"mux\")\n* [HTTP handler](https://github.com/hslam/handler \"handler\")\n\n## [Benchmark](http://github.com/hslam/http-benchmark \"http-benchmark\")\n\u003cimg src=\"https://raw.githubusercontent.com/hslam/http-benchmark/master/http-qps.png\" width = \"400\" height = \"300\" alt=\"qps\" align=center\u003e\u003cimg src=\"https://raw.githubusercontent.com/hslam/http-benchmark/master/http-p99.png\" width = \"400\" height = \"300\" alt=\"p99\" align=center\u003e\n\n## Get started\n\n### Install\n```\ngo get github.com/hslam/rum\n```\n### Import\n```\nimport \"github.com/hslam/rum\"\n```\n\n### Usage\n#### Simple Example\n```go\npackage main\n\nimport (\n\t\"github.com/hslam/rum\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tm := rum.New()\n\tm.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"Hello World\"))\n\t})\n\tm.Run(\":8080\")\n}\n```\n\ncurl http://localhost:8080\n```\nHello World\n```\n\n#### Example\n```go\npackage main\n\nimport (\n\t\"github.com/hslam/rum\"\n\t\"net/http\"\n)\n\nfunc main() {\n\tm := rum.New()\n\tm.SetPoll(true)\n\tm.Recovery(rum.Recovery)\n\tm.NotFound(func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.Error(w, \"Not Found : \"+r.URL.String(), http.StatusNotFound)\n\t})\n\tm.Use(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t})\n\tm.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"Hello World\"))\n\t})\n\tm.HandleFunc(\"/hello/:name\", func(w http.ResponseWriter, r *http.Request) {\n\t\tparams := m.Params(r)\n\t\tw.Write([]byte(\"Hello \" + params[\"name\"]))\n\t}).GET()\n\tm.Group(\"/group\", func(m *rum.Mux) {\n\t\tm.HandleFunc(\"/foo/:id\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\tparams := m.Params(r)\n\t\t\tw.Write([]byte(\"group/foo id:\" + params[\"id\"]))\n\t\t}).GET()\n\t\tm.HandleFunc(\"/bar/:id\", func(w http.ResponseWriter, r *http.Request) {\n\t\t\tparams := m.Params(r)\n\t\t\tw.Write([]byte(\"group/bar id:\" + params[\"id\"]))\n\t\t}).GET()\n\t})\n\tm.Run(\":8080\")\n}\n```\n\ncurl http://localhost:8080/hello/rum\n```\nHello rum\n```\n\ncurl http://localhost:8080/group/foo/1\n```\ngroup/foo id:1\n```\n\ncurl http://localhost:8080/group/bar/2\n```\ngroup/bar id:2\n```\n\n#### Use Other Router Example\nThe router must implement the http.Handler interface, for example using the http.ServeMux.\n```go\npackage main\n\nimport (\n\t\"github.com/hslam/rum\"\n\t\"net/http\"\n)\n\nfunc main() {\n\trouter := http.NewServeMux()\n\trouter.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"Hello World\"))\n\t})\n\tserver := rum.New()\n\tserver.Handler = router\n\tserver.Run(\":8080\")\n}\n```\n\n### License\nThis package is licensed under a MIT license (Copyright (c) 2020 Meng Huang)\n\n### Author\nrum was written by Meng Huang.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Frum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhslam%2Frum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Frum/lists"}