{"id":13741217,"url":"https://github.com/lpil/cgi","last_synced_at":"2026-01-29T10:49:32.505Z","repository":{"id":213764193,"uuid":"734875744","full_name":"lpil/cgi","owner":"lpil","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-16T11:15:53.000Z","size":13,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T23:04:47.729Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lpil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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-12-22T22:05:28.000Z","updated_at":"2024-08-03T04:07:47.402Z","dependencies_parsed_at":"2023-12-22T23:20:21.654Z","dependency_job_id":"6d2c6ce3-6706-4fe1-af11-447c98ba6ace","html_url":"https://github.com/lpil/cgi","commit_stats":null,"previous_names":["lpil/cgi"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpil%2Fcgi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpil%2Fcgi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpil%2Fcgi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpil%2Fcgi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lpil","download_url":"https://codeload.github.com/lpil/cgi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243753988,"owners_count":20342537,"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":[],"created_at":"2024-08-03T04:00:56.917Z","updated_at":"2026-01-29T10:49:27.485Z","avatar_url":"https://github.com/lpil.png","language":"Gleam","funding_links":[],"categories":["Packages"],"sub_categories":["HTTP Servers"],"readme":"# cgi\n\nCommon Gateway Interface (CGI) in Gleam.\n\n[![Package Version](https://img.shields.io/hexpm/v/cgi)](https://hex.pm/packages/cgi)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/cgi/)\n\nCGI is not commonly used these days, but there scenarios where it is still a\ngood choice. As CGI programs only run when there is a request to handle they do\nnot use any system resources when there is no traffic. This makes them very\nefficient for low traffic websites.\n\nIt also make deployment really simple! Just copy the new version of the\ncompiled CGI program onto the server and it'll be used for future requests.\n\n```sh\ngleam add cgi\n```\n```gleam\nimport cgi\nimport gleam/string\nimport gleam/http/response.{Response}\n\npub fn main() {\n  use request \u003c- cgi.handle_request\n  let headers = [#(\"content-type\", \"text/plain\")]\n  let body = \"Hello! You send me this request:\\n\\n\" \u003c\u003e string.inspect(request)\n  Response(201, headers, body)\n}\n```\n\nFor your CGI server to run your program you may wish to [compile your Gleam\nprogram to an escript][gleescript] if using the Erlang target, or bundling it\ninto a single JavaScript file if using the JavaScript target.\n\n[gleescript]: https://github.com/lpil/gleescript\n\nFurther documentation can be found at \u003chttps://hexdocs.pm/cgi\u003e.\n\nThank you to Steven vanZyl for [plug_cgi][1], which was used as a\nreference. Why is there so little information on the CGI protcol online\nthese days?\n\n[1]: https://github.com/rushsteve1/plug_cgi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpil%2Fcgi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flpil%2Fcgi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpil%2Fcgi/lists"}