{"id":20208395,"url":"https://github.com/fluture-js/fluture-fastify","last_synced_at":"2026-04-27T18:31:45.867Z","repository":{"id":97894357,"uuid":"169052626","full_name":"fluture-js/fluture-fastify","owner":"fluture-js","description":"Create Fastify handlers using Futures","archived":false,"fork":false,"pushed_at":"2020-03-21T11:06:41.000Z","size":22,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-11-24T03:16:02.208Z","etag":null,"topics":["fastify","fluture"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/fluture-js.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,"zenodo":null}},"created_at":"2019-02-04T09:09:47.000Z","updated_at":"2020-03-21T11:06:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"4dfd3b03-1440-409c-8c4a-54f11cb08265","html_url":"https://github.com/fluture-js/fluture-fastify","commit_stats":null,"previous_names":["wearereasonablepeople/fluture-fastify"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fluture-js/fluture-fastify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Ffluture-fastify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Ffluture-fastify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Ffluture-fastify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Ffluture-fastify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluture-js","download_url":"https://codeload.github.com/fluture-js/fluture-fastify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluture-js%2Ffluture-fastify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32349396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T17:12:42.749Z","status":"ssl_error","status_checked_at":"2026-04-27T17:12:41.658Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["fastify","fluture"],"created_at":"2024-11-14T05:35:25.211Z","updated_at":"2026-04-27T18:31:45.862Z","avatar_url":"https://github.com/fluture-js.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fluture Fastify\n[![Build Status](https://travis-ci.com/wearereasonablepeople/fluture-fastify.svg?branch=master)](https://travis-ci.com/wearereasonablepeople/fluture-fastify) [![Greenkeeper badge](https://badges.greenkeeper.io/fluture-js/fluture-fastify.svg)](https://greenkeeper.io/)\n\nCreate [Fastify][] handlers using [Future][]s from [Fluture][].\n\n## Usage\n\n```console\nnpm install --save fluture fluture-fastify\n```\n\nAllows using pure functions as Fastify handlers.\nExpects actions to return Futures and the reply\nto be decorated with a property `locals`\nthat will be passed to every action as its second argument.\n\n```javascript\nimport {handler, Typed} from 'fluture-fastify';\nimport {after} from 'fluture';\nimport createApp from 'fastify';\n\nconst app = createApp({logger: true});\n\nconst Json = Typed ('application/json; charset=utf-8');\nconst action = (req, {number}) =\u003e after (100, Json (200, number));\n\napp.decorateReply ('locals', {number: 42});\napp.get ('/number', handler ('getNumber', action));\n\napp.listen (3000, '0.0.0.0');\n```\n\n## API\n\n### Responses\n\n### \u003ca name=\"Typed\" href=\"https://github.com/wearereasonablepeople/fluture-fastify/blob/master/index.mjs#L42\"\u003e`Typed :: (Str, Num, Any) -⁠\u003e Response a`\u003c/a\u003e\n\nA typed response requires status code, some content and the\ncontent type. The type defines how the value is serialized.\nIn order to see all the possible combinations see [reply.send][] docs.\n\n#### Plain text\n```javascript\nconst Plain = Typed ('text/plain; charset=utf-8');\n\nPlain (200, 'Number 42');\n```\n#### Json\n\n```javascript\nconst Json = Typed ('application/json; charset=utf-8');\n\nJson (200, {number: 42});\n```\n#### Stream\n\n```javascript\nconst Stream = Typed ('application/octet-stream');\n\nStream (200, createReadStream ('file', 'utf8'));\n```\n### \u003ca name=\"Serialized\" href=\"https://github.com/wearereasonablepeople/fluture-fastify/blob/master/index.mjs#L68\"\u003e`Serialized :: (b -⁠\u003e c, Str, Num, b) -⁠\u003e Response a`\u003c/a\u003e\n\nA typed response with a custom serializer.\n\n```javascript\nconst Proto = Serialized (protoBuf.serialize, 'application/x-protobuf');\n\nProto (200, new protoBuf ());\n```\n### \u003ca name=\"Redirect\" href=\"https://github.com/wearereasonablepeople/fluture-fastify/blob/master/index.mjs#L77\"\u003e`Redirect :: (Num, Str) -⁠\u003e Response a`\u003c/a\u003e\n\nA redirection consisting of a URL and the status code.\n\n### \u003ca name=\"Empty\" href=\"https://github.com/wearereasonablepeople/fluture-fastify/blob/master/index.mjs#L81\"\u003e`Empty :: Response a`\u003c/a\u003e\n\nAn empty response with status code 204.\n\n### \u003ca name=\"NotFound\" href=\"https://github.com/wearereasonablepeople/fluture-fastify/blob/master/index.mjs#L85\"\u003e`NotFound :: Response a`\u003c/a\u003e\n\nThe default NotFound response.\n\n### Functions\n\n### \u003ca name=\"handler\" href=\"https://github.com/wearereasonablepeople/fluture-fastify/blob/master/index.mjs#L134\"\u003e`handler :: (Str, (Req, a) -⁠\u003e Future b (Response a)) -⁠\u003e (Req, Res a) -⁠\u003e undefined`\u003c/a\u003e\n\nCreates a Fastify handler from a named action. The action needs to either\nresolve to a Response or reject with anything.\nThe rejected value will be send as a response with status code 500. The\nstatus code can be overwritten by rejecting with an Error that contains\nthe prop `statusCode`.\n\n[Fluture]: https://github.com/fluture-js/Fluture\n[Future]: https://github.com/fluture-js/Fluture#future\n[Fastify]: https://github.com/fastify/Fastify\n[reply.send]: https://github.com/fastify/fastify/blob/master/docs/Reply.md#senddata\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluture-js%2Ffluture-fastify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluture-js%2Ffluture-fastify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluture-js%2Ffluture-fastify/lists"}