{"id":13726285,"url":"https://github.com/leostera/httpkit","last_synced_at":"2025-05-07T21:32:02.102Z","repository":{"id":141534853,"uuid":"163272928","full_name":"leostera/httpkit","owner":"leostera","description":"⚡️ High-level, High-performance HTTP(S) Clients/Servers in Reason/OCaml","archived":true,"fork":false,"pushed_at":"2019-12-19T13:38:26.000Z","size":336,"stargazers_count":202,"open_issues_count":7,"forks_count":9,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-08T13:03:35.981Z","etag":null,"topics":["client","developer-experience","http","http-framework","https","middleware","native","ocaml","reasonml","server"],"latest_commit_sha":null,"homepage":"","language":"OCaml","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/leostera.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-12-27T09:10:15.000Z","updated_at":"2024-01-12T14:46:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"e6b3a0c2-71ee-4daf-b4ba-bc51ee12d388","html_url":"https://github.com/leostera/httpkit","commit_stats":null,"previous_names":["leostera/httpkit","ostera/httpkit"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhttpkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhttpkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhttpkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leostera%2Fhttpkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leostera","download_url":"https://codeload.github.com/leostera/httpkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224587023,"owners_count":17335952,"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":["client","developer-experience","http","http-framework","https","middleware","native","ocaml","reasonml","server"],"created_at":"2024-08-03T01:02:58.055Z","updated_at":"2024-11-14T16:33:39.675Z","avatar_url":"https://github.com/leostera.png","language":"OCaml","readme":"# ⚡️HttpKit — high-level, high-performance HTTP1.1/2 clients/servers in Reason\n\n\u003e NOTE: under heavy reconstruction. Latest stable version was [`660d1c8`](https://github.com/ostera/httpkit/tree/660d1c8b7438d207be2717495d8590a529bf5a1f)\n\nHttpKit is a high-level library for building and consuming web servers over\nHTTP, HTTPS, and HTTP2.\n\nIt serves as a thin layer over `h2` and `http/af`, and when it can it allows you\nto seamlessly transition from one to the other.\n\n0. [Roadmap](#roadmap)\n1. [Getting Started](#getting-started)\n1. [Running the Examples](#running-the-examples)\n\n## Roadmap\n\n| Feature          | HTTP/1.1 | HTTPS/1.1 | HTTP/2 | HTTPS/2 |\n|------------------|----------|-----------|--------|---------|\n| Listen as Server | Yes      | No        | Yes    | No      |\n| Send Request     | Yes      | Yes       | No     | No      |\n| Server Push      | -        | -         | No     | No      |\n|                  |          |           |        |         |\n\n## Getting Started\n\n#### Usage\n\n`httpkit` can be used both to build servers and to make requests as a client.\n\nDocumentation is still a work-in-progress, but there's examples in the\n`examples` section that can give you a better idea of how to use the libraries.\nIn short:\n\nFor making a request:\n\n```reason\nopen Lwt_result.Infix;\n\nmodule Httpkit = Httpkit_lwt_unix_httpaf;\n\nlet req =\n  Httpkit.Request.create(\n    ~headers=[(\"User-Agent\", \"Reason HttpKit\")],\n    `GET,\n    Uri.of_string(\"http://api.github.com/repos/ostera/httpkit\"),\n  );\n\n/* Send over HTTP */\nreq\n|\u003e Httpkit.Client.Http.send\n\u003e\u003e= Httpkit.Client.Response.body\n|\u003e Lwt_main.run\n\n/* Send over HTTPS */\nreq\n|\u003e Httpkit.Client.Https.send\n\u003e\u003e= Httpkit.Client.Response.body\n|\u003e Lwt_main.run\n```\n\nFor making a server:\n\n```reason\nmodule Httpkit = Httpkit_lwt_unix_httpaf;\n\nlet port = 8080;\n\nlet on_start = (~hoststring) =\u003e\n  Logs.app(m =\u003e m(\"Running on %s\", hoststring));\n\nlet handler: Httpkit.Server.handler =\n  (req, reply, kill_server) =\u003e {\n    let method = req |\u003e Httpkit.Request.meth |\u003e H2.Method.to_string;\n    let path = req |\u003e Httpkit.Request.path;\n    Logs.app(m =\u003e m(\"%s %s\", method, path));\n    reply(200, \"hi\");\n    kill_server();\n  };\n\n/* Start server over HTTP */\nHttpkit.Server.Http.listen(~port, ~address=`Any, ~handler, ~on_start)\n|\u003e Lwt_main.run;\n\n/* Start server over HTTPS */\nHttpkit.Server.Http.listen(~port, ~address=`Any, ~handler, ~on_start)\n|\u003e Lwt_main.run;\n```\n\n#### Installing with esy\n\nYou can install by dropping the following dependencies in your `package.json`:\n\n```json\n{\n  \"dependencies\": {\n    \"@opam/httpkit\": \"*\",\n    \"@opam/httpkit-lwt-unix-httpaf\": \"*\",\n    \"@opam/logs\": \"*\",\n    \"@opam/fmt\": \"*\",\n    // ...\n  },\n  \"resolutions\": {\n    \"@opam/httpkit\": \"ostera/httpkit:httpkit.opam#f738417\",\n    \"@opam/httpkit-lwt-unix-httpaf\": \"ostera/httpkit:httpkit-lwt-unix-httpaf.opam#f738417\",\n  }\n}\n```\n\n\u003e NOTE: For `httpkit` make sure you're using the latest commit hash!\n\n## Running the Examples\n\nAll of the examples are runnable as binaries after compilation, so you can\neither run `esy build` and find them within\n`./_esy/default/build/default/examples/*.exe` or you can ask dune to run them\nfor you:\n\n```sh\nostera/httpkit λ esy dune exec ./examples/Request.exe\n```\n","funding_links":[],"categories":["OCaml"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleostera%2Fhttpkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleostera%2Fhttpkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleostera%2Fhttpkit/lists"}