{"id":15840088,"url":"https://github.com/renanbastos93/go-function-simulator","last_synced_at":"2025-04-01T17:19:02.822Z","repository":{"id":255808757,"uuid":"851654074","full_name":"renanbastos93/go-function-simulator","owner":"renanbastos93","description":"Run functions locally with Go, like Aws Lambda","archived":false,"fork":false,"pushed_at":"2024-09-03T21:38:12.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T21:06:15.754Z","etag":null,"topics":["cloud","edge","function","go","lambda"],"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/renanbastos93.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":"2024-09-03T13:41:17.000Z","updated_at":"2024-09-03T23:54:36.000Z","dependencies_parsed_at":"2024-11-08T08:31:06.659Z","dependency_job_id":null,"html_url":"https://github.com/renanbastos93/go-function-simulator","commit_stats":null,"previous_names":["renanbastos93/go-function-simulator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanbastos93%2Fgo-function-simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanbastos93%2Fgo-function-simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanbastos93%2Fgo-function-simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renanbastos93%2Fgo-function-simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renanbastos93","download_url":"https://codeload.github.com/renanbastos93/go-function-simulator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246679061,"owners_count":20816402,"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":["cloud","edge","function","go","lambda"],"created_at":"2024-10-05T16:41:32.851Z","updated_at":"2025-04-01T17:19:02.802Z","avatar_url":"https://github.com/renanbastos93.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-function-simulator\nRun functions locally with Go.\n\n## Overview\nIt is a tool designed to help you run and test your functions locally with Go. It supports various HTTP request types and frameworks such as Fiber, Gorilla Mux, and Chi. This allows you to simulate and debug AWS Lambda functions or any HTTP-based services on your local machine.\n\n## Features\n\n- **Support for Multiple Request Types:** Handle and simulate HTTP requests using different frameworks.\n- **Flexible Conversion:** Convert HTTP requests to AWS API Gateway proxy requests and vice versa.\n- **Easy Integration:** Seamlessly integrate with your existing Go projects.\n\n## Installation\n\nTo install `go-function-simulator`, you can use Go modules to add it to your project:\n\n```bash\n$ go get github.com/yourusername/go-function-simulator\n```\n\n## Usage Fiber\n```go\npackage main\n\nimport (\n\t\"github.com/gofiber/fiber/v2\"\n\t\"github.com/renanbastos93/go-function-simulator/pkg/http\"\n)\n\nfunc main() {\n\tapp := fiber.New()\n\n\tapp.Get(\"/path/:id\", func(c *fiber.Ctx) error {\n\t\tapiGatewayProxyRequest := http.ConvertHTTPRequestToAPIGatewayProxyRequest(c.Context(), c)\n        fmt.Println(\"API Gateway Proxy Request:\", apiGatewayProxyRequest)\n\t\t// call your lambda function\n\t\t// like this: usecase.Lambda(ctx, apiGatewayProxyRequest)\n\t\treturn c.SendStatus(fiber.StatusOK)\n\t})\n\n\t_ = app.Listen(\":3000\")\n}\n\n```\n\n## Usage Gorilla Mux\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\tstdHttp \"net/http\"\n\n\t\"github.com/gorilla/mux\"\n\t\"github.com/renanbastos93/go-function-simulator/pkg/http\"\n)\n\nfunc main() {\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/path/{id}\", func(w stdHttp.ResponseWriter, r *stdHttp.Request) {\n\t\tapiGatewayProxyRequest := http.ConvertHTTPRequestToAPIGatewayProxyRequest(context.Background(), r)\n\t\tfmt.Println(\"API Gateway Proxy Request:\", apiGatewayProxyRequest)\n\t\t/// call your lambda function\n\t\t// like this: usecase.Lambda(ctx, apiGatewayProxyRequest)\n\t\tw.WriteHeader(stdHttp.StatusOK)\n\t})\n\n\t_ = stdHttp.ListenAndServe(\":3000\", r)\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenanbastos93%2Fgo-function-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenanbastos93%2Fgo-function-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenanbastos93%2Fgo-function-simulator/lists"}