{"id":34197320,"url":"https://github.com/floscodes/go-routex","last_synced_at":"2026-03-12T17:26:37.497Z","repository":{"id":61625311,"uuid":"540593100","full_name":"floscodes/go-routex","owner":"floscodes","description":"Easy to use router for http-services","archived":false,"fork":false,"pushed_at":"2023-01-01T11:59:11.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-18T19:29:08.709Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/floscodes.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":"2022-09-23T19:42:11.000Z","updated_at":"2022-12-22T23:07:36.000Z","dependencies_parsed_at":"2023-01-31T22:01:04.199Z","dependency_job_id":null,"html_url":"https://github.com/floscodes/go-routex","commit_stats":null,"previous_names":["floscodes/go-http-router"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/floscodes/go-routex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floscodes%2Fgo-routex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floscodes%2Fgo-routex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floscodes%2Fgo-routex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floscodes%2Fgo-routex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floscodes","download_url":"https://codeload.github.com/floscodes/go-routex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floscodes%2Fgo-routex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30434886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: 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":"2025-12-15T17:36:17.232Z","updated_at":"2026-03-12T17:26:37.492Z","avatar_url":"https://github.com/floscodes.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# routex is an easy to use router for http-services \n\n### Set routes and link them to functions\n\n```go\nfunc main() {\n\trouter := routex.New()\n\n\trouter.Handle(\"/hello\", hello)\n\n\tfmt.Println(\"Server is listening\")\n\thttp.ListenAndServe(\":8080\", router)\n\n}\n\nfunc hello(w http.ResponseWriter, r *http.Request) {\n    w.Write([]byte(\"Hello!\"))\n}\n```\n\nYou can specify the allowed methods like this:\n```go\nrouter.Handle(\"/hello\", hello).Methods(\"POST\", \"GET\")\n```\n\nOr set them for all configured paths:\n```go\nrouter.Methods(\"POST\", \"GET\")\n```\n\nThe router will accept trailing slashes typed by the client by default, even if none is set in the handling path.\nYou can disable that this way for a certain route...\n```go\nrouter.Handle(\"/hello\", hello).AcceptTrailingSlash(false)\n```\n... or disable it for all routes:\n```go\nrouter.AcceptTrailingSlash(false)\n```\n\n### Serve static files\n\n```go\nrouter.ServeStatic(\"/static\", \"./static\")\n```\n\nIf the request does not contain a specific filename, the router will automatically look for `index.html`.\n\nOptionally you can set a custom index file:\n```go\nrouter.ServeStatic(\"/static\", \"./static\").IndexFile(\"template.html\")\n```\n\n### Allow CORS\n\nYou can just allow CORS like this:\n```go\nrouter.AllowCORS(true)\n```\n\nor for a single route.\n```go\nrouter.Handle(\"/api\", api).AllowCORS(true)\n```\n\n**Whenever allowing CORS it is highly recommended to define the allowed methods, otherwise all methods will be accepted!**\n\nHowever, custom CORS heraders could be set by yourself at anytime in your handler functions.\n\n```go\nrouter.Handle(\"/api\", api).AllowCORS(true).Methods(\"GET\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloscodes%2Fgo-routex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloscodes%2Fgo-routex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloscodes%2Fgo-routex/lists"}