{"id":13430879,"url":"https://github.com/apex/gateway","last_synced_at":"2025-05-16T10:07:19.448Z","repository":{"id":37617504,"uuid":"117922077","full_name":"apex/gateway","owner":"apex","description":"Drop-in replacement for Go net/http when running in AWS Lambda \u0026 API Gateway ","archived":false,"fork":false,"pushed_at":"2022-07-14T17:25:27.000Z","size":41,"stargazers_count":652,"open_issues_count":18,"forks_count":75,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-09T04:07:48.617Z","etag":null,"topics":["aws-lambda","golang","serverless"],"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/apex.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","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":"2018-01-18T02:42:34.000Z","updated_at":"2024-07-09T09:50:31.000Z","dependencies_parsed_at":"2022-07-12T16:33:56.075Z","dependency_job_id":null,"html_url":"https://github.com/apex/gateway","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apex%2Fgateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apex%2Fgateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apex%2Fgateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apex%2Fgateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apex","download_url":"https://codeload.github.com/apex/gateway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509476,"owners_count":22082891,"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":["aws-lambda","golang","serverless"],"created_at":"2024-07-31T02:00:58.667Z","updated_at":"2025-05-16T10:07:14.439Z","avatar_url":"https://github.com/apex.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"\u003cimg src=\"http://tjholowaychuk.com:6000/svg/title/APEX/GATEWAY\"\u003e\n\nPackage gateway provides a drop-in replacement for net/http's `ListenAndServe` for use in [AWS Lambda](https://aws.amazon.com/lambda/) \u0026 [API Gateway](https://aws.amazon.com/api-gateway/), simply swap it out for `gateway.ListenAndServe`. Extracted from [Up](https://github.com/apex/up) which provides additional middleware features and operational functionality.\n\nThere are two versions of this library, version 1.x supports AWS API Gateway 1.0 events used by the original [REST APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.html), and 2.x which supports 2.0 events used by the [HTTP APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html). For more information on the options read [Choosing between HTTP APIs and REST APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html) on the AWS documentation website.\n\n# Installation\n\nTo install version 1.x for REST APIs. \n\n```\ngo get github.com/apex/gateway\n```\n\nTo install version 2.x for HTTP APIs. \n\n```\ngo get github.com/apex/gateway/v2\n```\n\n# Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\n\t\"github.com/apex/gateway\"\n)\n\nfunc main() {\n\thttp.HandleFunc(\"/\", hello)\n\tlog.Fatal(gateway.ListenAndServe(\":3000\", nil))\n}\n\nfunc hello(w http.ResponseWriter, r *http.Request) {\n\t// example retrieving values from the api gateway proxy request context.\n\trequestContext, ok := gateway.RequestContext(r.Context())\n\tif !ok || requestContext.Authorizer[\"sub\"] == nil {\n\t\tfmt.Fprint(w, \"Hello World from Go\")\n\t\treturn\n\t}\n\n\tuserID := requestContext.Authorizer[\"sub\"].(string)\n\tfmt.Fprintf(w, \"Hello %s from Go\", userID)\n}\n```\n\n---\n\n[![GoDoc](https://godoc.org/github.com/apex/up-go?status.svg)](https://godoc.org/github.com/apex/gateway)\n![](https://img.shields.io/badge/license-MIT-blue.svg)\n![](https://img.shields.io/badge/status-stable-green.svg)\n\n\u003ca href=\"https://apex.sh\"\u003e\u003cimg src=\"http://tjholowaychuk.com:6000/svg/sponsor\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapex%2Fgateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapex%2Fgateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapex%2Fgateway/lists"}