{"id":42019352,"url":"https://github.com/doug/middleware","last_synced_at":"2026-01-26T03:31:25.679Z","repository":{"id":17524809,"uuid":"20312872","full_name":"doug/middleware","owner":"doug","description":"go net/http middleware using container/list","archived":false,"fork":false,"pushed_at":"2014-05-31T19:14:32.000Z","size":187,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T00:28:24.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doug.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":"2014-05-30T00:52:10.000Z","updated_at":"2014-05-31T19:14:30.000Z","dependencies_parsed_at":"2022-09-26T21:31:10.558Z","dependency_job_id":null,"html_url":"https://github.com/doug/middleware","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/doug/middleware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug%2Fmiddleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug%2Fmiddleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug%2Fmiddleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug%2Fmiddleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doug","download_url":"https://codeload.github.com/doug/middleware/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doug%2Fmiddleware/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28765887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T03:19:35.311Z","status":"ssl_error","status_checked_at":"2026-01-26T03:19:13.815Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-26T03:31:25.040Z","updated_at":"2026-01-26T03:31:25.675Z","avatar_url":"https://github.com/doug.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Middleware\n\nSimple middleware on top of container/list. Middleware interface is\n`func(rw http.ResponseWriter, r *http.Response, next http.HandlerFunc)`.\n\n## Example Use\n\n~~~ go\n\nrouter := mux.NewRouter()\nrouter.HandleFunc(\"/\", SomeHandler)\n\ns := middleware.NewStack()\ns.Use(Middleware1)\nelement2 := s.Use(Middleware2)\ns.Use(Middleware4)\ns.UseHandler(router)\n\n// You can modify the stack because it is a container/list\ns.InsertAfter(Middleware3, element2)\n\n// Or compose some set of middleware and use it\ns2 := middleware.NewStack()\ns2.Use(MiddlewareA)\ns2.Use(MiddlewareB)\n// Add this middleware stack to the front of the other one.\ns.PushFrontList(s2.List)\n\n// Compose converts a Middleware into a func(http.HandlerFunc)http.HandlerFunc\n// so it can be called with Alice or just composing(functions(like(this))).\nm1 := middleware.Compose(MiddlewareA)\nm2 := middleware.Compose(MiddlewareB)\nm3 := middleware.Compose(MiddlewareC)\n\n// Stack 3\ns3 := m1(m2(m3(http.DefaultServeMux)))\n\n~~~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoug%2Fmiddleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoug%2Fmiddleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoug%2Fmiddleware/lists"}