{"id":28577370,"url":"https://github.com/gleam-lang/plug","last_synced_at":"2025-12-11T23:40:07.411Z","repository":{"id":62429855,"uuid":"287969799","full_name":"gleam-lang/plug","owner":"gleam-lang","description":"🔌 A Gleam HTTP service adapter for the Plug web application interface","archived":false,"fork":false,"pushed_at":"2020-08-27T19:31:09.000Z","size":17,"stargazers_count":34,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-02T07:33:49.336Z","etag":null,"topics":["elixir","gleam","http"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/gleam_plug","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gleam-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":"2020-08-16T15:21:57.000Z","updated_at":"2025-02-14T01:33:50.000Z","dependencies_parsed_at":"2022-11-01T20:03:55.154Z","dependency_job_id":null,"html_url":"https://github.com/gleam-lang/plug","commit_stats":null,"previous_names":["gleam-experiments/plug"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fplug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fplug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fplug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fplug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gleam-lang","download_url":"https://codeload.github.com/gleam-lang/plug/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gleam-lang%2Fplug/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259177243,"owners_count":22817337,"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":["elixir","gleam","http"],"created_at":"2025-06-11T00:37:32.289Z","updated_at":"2025-12-11T23:40:02.362Z","avatar_url":"https://github.com/gleam-lang.png","language":"Elixir","readme":"# Gleam Plug! 🔌\n\nA Gleam HTTP service adapter for the Plug web application interface.\n\n## Usage\n\nDefine a Gleam HTTP service\n\n```rust\nimport gleam/http\nimport gleam/bit_builder.{BitBuilder}\n\npub fn service(req: http.Request(BitBuilder)) {\n  http.response(200)\n  |\u003e http.prepend_resp_header(\"made-with\", \"Gleam\")\n  |\u003e http.set_resp_body(req.body)\n}\n```\n\nAnd then call it from an Elixir Plug application\n\n```elixir\ndefmodule MyPlug do\n  def init(options) do\n    options\n  end\n\n  def call(conn, body) do\n    conn\n    |\u003e GleamPlug.call_service(body, \u0026:my_gleam_module.service/1)\n  end\nend\n```\n\nPhoenix controllers are Plugs and so Gleam services can be called from them\nin the same way.\n\n```elixir\ndefmodule MyAppWeb.UserController do\n  use MyAppWeb, :controller\n\n  def show(conn, params) do\n    conn\n    |\u003e GleamPlug.call_service(params, \u0026:my_gleam_module.service/1)\n  end\nend\n```\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `gleam_plug` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:gleam_plug, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/gleam_plug](https://hexdocs.pm/gleam_plug).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgleam-lang%2Fplug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgleam-lang%2Fplug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgleam-lang%2Fplug/lists"}