{"id":15061678,"url":"https://github.com/kit-p/fastify-tasks","last_synced_at":"2025-04-10T09:27:50.394Z","repository":{"id":255869683,"uuid":"853786447","full_name":"Kit-p/fastify-tasks","owner":"Kit-p","description":"Tasks tracking plugin for fastify","archived":false,"fork":false,"pushed_at":"2025-02-01T07:15:02.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T08:21:18.423Z","etag":null,"topics":["fastify","fastify-plugin","javascript"],"latest_commit_sha":null,"homepage":"","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/Kit-p.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-07T14:34:29.000Z","updated_at":"2025-02-01T07:14:59.000Z","dependencies_parsed_at":"2024-09-07T16:11:26.149Z","dependency_job_id":"808fc8ec-58aa-4288-8ad1-c11841b75617","html_url":"https://github.com/Kit-p/fastify-tasks","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.25,"last_synced_commit":"9e1b869b66dfc6e5b7161d5a6e7ba58578750659"},"previous_names":["kit-p/fastify-tasks"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kit-p%2Ffastify-tasks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kit-p%2Ffastify-tasks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kit-p%2Ffastify-tasks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kit-p%2Ffastify-tasks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kit-p","download_url":"https://codeload.github.com/Kit-p/fastify-tasks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248191066,"owners_count":21062413,"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":["fastify","fastify-plugin","javascript"],"created_at":"2024-09-24T23:23:35.921Z","updated_at":"2025-04-10T09:27:50.369Z","avatar_url":"https://github.com/Kit-p.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @kit-p/fastify-tasks\n\n![CI](https://github.com/Kit-p/fastify-tasks/workflows/CI/badge.svg)\n[![NPM version](https://img.shields.io/npm/v/@kit-p/fastify-tasks.svg?style=flat)](https://www.npmjs.com/package/@kit-p/fastify-tasks)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)\n\nAdd task tracking support for Fastify. The server will not close until all tasks are completed.\n\n`@kit-p/fastify-tasks` decorates the server interface with the `tasks.add` and `tasks.remove` methods for tracking tasks.\n\n## Install\n\n```\nnpm i @kit-p/fastify-tasks\n```\n\n\u003ca name=\"quickstart\"\u003e\u003c/a\u003e\n\n## Quick start\n\n`fastify.register` is used to register @kit-p/fastify-tasks. By default, It will decorate the `fastify` object with `tasks.add` and `tasks.remove` methods that take an optional argument:\n\n- the name of the task (does not need to be unqiue)\n\n```js\n// index.js:\nconst fastify = require(\"fastify\")()\nconst fastifyTasks = require(\"@kit-p/fastify-tasks\")\n\nfastify.register(fastifyTasks)\n\n// named task:\nfastify.get(\"/\", (req, reply) =\u003e {\n  fastify.tasks.add('some-task')\n  reply.send('')\n  // do some work\n  fastify.tasks.remove('some-task')\n})\n\n// unnamed task:\nfastify.get(\"/\", (req, reply) =\u003e {\n  fastify.tasks.add()\n  reply.send('')\n  // do some work\n  fastify.tasks.remove()\n})\n\nfastify.listen({ port: 3000 }, (err) =\u003e {\n  if (err) throw err;\n  console.log(`server listening on ${fastify.server.address().port}`);\n})\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkit-p%2Ffastify-tasks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkit-p%2Ffastify-tasks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkit-p%2Ffastify-tasks/lists"}