{"id":16122033,"url":"https://github.com/foxcapades/swrv","last_synced_at":"2025-07-29T11:09:03.769Z","repository":{"id":197423875,"uuid":"698626220","full_name":"Foxcapades/swrv","owner":"Foxcapades","description":"Yet another Golang HTTP framework","archived":false,"fork":false,"pushed_at":"2023-10-01T20:13:03.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-08T06:04:31.305Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Foxcapades.png","metadata":{"files":{"readme":"readme.adoc","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":"2023-09-30T13:30:48.000Z","updated_at":"2023-09-30T13:32:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"d64c3ac9-611f-4c91-814a-ec8692d83faf","html_url":"https://github.com/Foxcapades/swrv","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"4aad641be6259d1a3e339f3e6e0a5e8ad20fe4d8"},"previous_names":["foxcapades/swrv"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Foxcapades/swrv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxcapades%2Fswrv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxcapades%2Fswrv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxcapades%2Fswrv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxcapades%2Fswrv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Foxcapades","download_url":"https://codeload.github.com/Foxcapades/swrv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Foxcapades%2Fswrv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267677246,"owners_count":24126313,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-10-09T21:09:08.274Z","updated_at":"2025-07-29T11:09:03.747Z","avatar_url":"https://github.com/Foxcapades.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"= SWeRVe\n\nYet another Go HTTP framework.\n\n[source, go]\n----\nimport \"github.com/foxcapades/swrv/pkg/swrv\"\n----\n\nA simple way to setup an HTTP server with request and response filtering.\n\n.Simple Setup\n[source, go]\n----\ntype Response struct {\n  Message string `json:\"message\"`\n}\n\nfunc main() {\n  swrv.NewServer(\"0.0.0.0\", 8080).\n    WithObjectSerializers(swrv.NewDefaultJSONObjectSerializer()).\n    WithControllers(\n      swrv.NewController(\"/hello/{name}\", swrv.RequestHandlerFunc(func(request swrv.Request) swrv.Response {\n        return swrv.NewResponse().\n          WithBody(Response{fmt.Sprintf(\"Hello %s!\", request.URIParam(\"name\"))})\n      })),\n    ).\n    Start(nil)\n}\n----\n\nMore examples available at https://github.com/Foxcapades/swrv-examples[].\n\n== Concepts\n\n=== Controllers\n\nA controller is a collection of filters and a request handler that process an\nincoming HTTP request and return a response.  The core of a controller is the\nrequest handler which is intended to perform the core logic of the request\nprocessing.\n\n=== Request Filters\n\nA request filter is a middleware layer that processes a request before it\nreaches the controller, optionally halting the request from further processing\nand forcing an early response.  Examples of request filters include\nauthentication layers, request-id generation, request timing starts.\n\nIf a request filter returns `nil`, the request will continue processing, moving\non to either the next registered request filter, or the controller.  If a\nrequest filter returns a non-`nil` response, that response will be returned to\nthe calling HTTP client with no further request processing; this response will,\nhowever, be processed by \u003c\u003cResponse Filters\u003e\u003e.\n\nRequest filters are executed in the order they are registered, with global\nrequest filters being applied before controller specific request filters.\n\n=== Response Filters\n\nA response filter is a middleware layer that processes a response before it is\nreturned to the HTTP client.  Response filters may modify or entirely replace\nthe response before it goes out the door.  Response filters are required to\nreturn a `Response` value.  Examples of response filters include request timing\nends and response code loggers.\n\nIf a response filter returns `nil` the response to the client will be a 500\nerror.\n\nResponse filters are always hit.\n\nResponse filters are executed in the order they are registered with global\nresponse filters being applied _after_ controller-specific response filters.\n\n=== Object Serializers\n\nAn object serializer is a type that is used to serialize non-stream response\nobjects to be returned to the HTTP client.  For example, a JSON object\nserializer may be used to encode response body values as JSON.\n\nIf a response body is an `io.Reader` or `io.ReadCloser` the value will be\nstreamed directly to the client with no processing.  If the response body is\nan `io.ReadCloser` it will be closed when streaming is completed.\n\nIn addition to serializing data, object serializers may choose which objects or\nresponses they apply to.  So, for example, an object serializer may look for a\n`Content-Type` header and choose to process the response only if the header\nvalue is `application/json`.\n\nSwrv includes a JSON serializer by default which may be used with an optional\nresponse filter, or may be used to serialize all non-stream response bodies.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxcapades%2Fswrv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoxcapades%2Fswrv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoxcapades%2Fswrv/lists"}