{"id":16484448,"url":"https://github.com/winston0410/better-fastify-405","last_synced_at":"2026-04-21T10:03:17.107Z","repository":{"id":53486661,"uuid":"352490471","full_name":"winston0410/better-fastify-405","owner":"winston0410","description":"A better plugin for handling 405 in Fastify.","archived":false,"fork":false,"pushed_at":"2021-03-30T08:51:17.000Z","size":122,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-13T02:46:47.406Z","etag":null,"topics":["fastify","fastify-405","fastify-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/winston0410.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}},"created_at":"2021-03-29T02:17:22.000Z","updated_at":"2021-03-30T08:51:07.000Z","dependencies_parsed_at":"2022-08-19T05:24:19.385Z","dependency_job_id":null,"html_url":"https://github.com/winston0410/better-fastify-405","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/winston0410/better-fastify-405","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fbetter-fastify-405","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fbetter-fastify-405/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fbetter-fastify-405/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fbetter-fastify-405/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winston0410","download_url":"https://codeload.github.com/winston0410/better-fastify-405/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winston0410%2Fbetter-fastify-405/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267960158,"owners_count":24172489,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","fastify-405","fastify-plugin"],"created_at":"2024-10-11T13:17:08.320Z","updated_at":"2026-04-21T10:03:17.045Z","avatar_url":"https://github.com/winston0410.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Better Fastify 405\n\nA simple and fully customizable Fastify plugin for handling 405 gracefully.\n\n[![Maintainability](https://api.codeclimate.com/v1/badges/23557cfcd9416cc4f098/maintainability)](https://codeclimate.com/github/winston0410/better-fastify-405/maintainability) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/a88113b4d6ac4acbb90be5864aacae27)](https://www.codacy.com/gh/winston0410/better-fastify-405/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=winston0410/better-fastify-405\u0026amp;utm_campaign=Badge_Grade) [![Test Coverage](https://api.codeclimate.com/v1/badges/23557cfcd9416cc4f098/test_coverage)](https://codeclimate.com/github/winston0410/better-fastify-405/test_coverage)\n\n## Why do I need this?\n\nBy default [Fastify suppress error 405](https://github.com/fastify/fastify/issues/917) and with return 404 instead. A 405 error would improve the development experience.\n\n[fastify-405](https://github.com/Eomm/fastify-405) was built to solve this issue, but it requires you to input a RegExp for the route you want to handle 405.\n\nThis plugin is meant to read from your current route setting, and create routes that return 405 automatically.\n\n## Installation\n\n```shell\nnpm add better-fastify-405\n```\n\n```shell\nyarn add better-fastify-405\n```\n\n## Usage\n\n```javascript\n//app.js\nimport fastify, { FastifyRequest, FastifyReply, FastifyInstance, HookHandlerDoneFunction, RouteOptions } from 'fastify';\n\nconst app: FastifyInstance = fastify({\n  logger: true\n})\n\n//Other plugins\napp.register(import(\"fastify-etag\"))\napp.register(import('plugins/better-fastify-405'), {\n  routes: [\n    //Required.\n\t\t//Register all your route here, or else this plugin would not work.\n    import('./routes/index'),\n    import('./routes/protected')\n\t\t//All the route will be registered inside the plugin. Do not use app.register() here.\n  ],\n  filterCallback: ({ route, method }) =\u003e {\n    // Optional\n    // A callback to allow you filter out specific route and specific method from assigning it to 405\n\n    //Route: route registered\n    //Method: method available to apply 405\n    return true\n  }\n})\n```\n\n### Do not mark `OPTIONS` route with 405\n\nA function `allowCORS` is provided to help you not mark `OPTIONS` for 405.\n\n```javascript\nimport better405, { allowCORS } from 'better-fastify-405'\n\nimport fastify, { FastifyRequest, FastifyReply, FastifyInstance, HookHandlerDoneFunction, RouteOptions } from 'fastify';\n\nconst app: FastifyInstance = fastify({\n  logger: true\n})\n\n//Other plugins\napp.register(import(\"fastify-etag\"))\napp.register(better405, {\n  routes: [\n    import('./routes/index'),\n    import('./routes/protected')\n  ],\n  filterCallback: allowCORS\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinston0410%2Fbetter-fastify-405","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinston0410%2Fbetter-fastify-405","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinston0410%2Fbetter-fastify-405/lists"}