{"id":17647682,"url":"https://github.com/pacifiquem/node-async-handler","last_synced_at":"2025-05-07T03:23:25.503Z","repository":{"id":215432841,"uuid":"618736471","full_name":"pacifiquem/node-async-handler","owner":"pacifiquem","description":"Async Error Handling Middleware for ExpressJS with ESM/TypeScript support.","archived":false,"fork":false,"pushed_at":"2024-01-09T17:28:57.000Z","size":213,"stargazers_count":26,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-16T00:14:30.821Z","etag":null,"topics":["async","error","error-handling","express","handling","node","nodejs","try-catch"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/pacifiquem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["pacifiquem"]}},"created_at":"2023-03-25T07:38:36.000Z","updated_at":"2024-03-30T12:43:10.000Z","dependencies_parsed_at":"2024-01-09T18:20:57.924Z","dependency_job_id":"c380ea7e-491b-4a3c-af32-448643904c0d","html_url":"https://github.com/pacifiquem/node-async-handler","commit_stats":null,"previous_names":["pacifiquem/asyncaid","pacifiquem/node-async-handler"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifiquem%2Fnode-async-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifiquem%2Fnode-async-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifiquem%2Fnode-async-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifiquem%2Fnode-async-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pacifiquem","download_url":"https://codeload.github.com/pacifiquem/node-async-handler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249714767,"owners_count":21314910,"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":["async","error","error-handling","express","handling","node","nodejs","try-catch"],"created_at":"2024-10-23T11:14:12.867Z","updated_at":"2025-04-19T14:31:43.074Z","avatar_url":"https://github.com/pacifiquem.png","language":"TypeScript","funding_links":["https://github.com/sponsors/pacifiquem"],"categories":[],"sub_categories":[],"readme":"# node-async-handler\n\nAsync Error Handling Middleware for Express with ESM Support\n\nThis middleware helps you eliminate the need for ```try-catch``` blocks throughout your Express application, streamlining error handling and improving code readability.\n\n\u003e **Note** : This is made specifically for ExpressJS projects.\n\n## Usage\n\nTo use ```node-async-handler```, simply wrap your async functions in the asyncHandler middleware:\n\n```ts\n// For ESM\nimport pkg from 'node-async-handler';\nconst { asyncHandler } = pkg;\n\n// For CommonJS\nconst { asyncHandler } = require('node-async-handler');\n\nexpress.get('/', asyncHandler(async (req: Request, res: Response, next: NextFunction) =\u003e {\n  const result = await someAsyncFunction();\n  res.json(result);\n}));\n```\n\nIn case of an error, the middleware automatically calls ```next(error)```, allowing centralized error handling in your Express app.\n\n## Importing\n\n\u003e **Note** : To import ```node-async-handler``` in ESM:\n\u003e\n\u003e ```ts\n\u003e import pkg from 'node-async-handler';\n\u003e const { asyncHandler } = pkg;\n\u003e```\n\n\u003e **Note** : To import ```node-async-handler``` in CommonJS:\n\u003e\n\u003e ```ts\n\u003e const { asyncHandler } = require('node-async-handler');\n\u003e```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE file](https://github.com/pacifiquem/node-async-handler/blob/main/LICENSE) for details.\n\n\u003cp align=\"right\" style=\"color: gray;\"\u003eAuthor: MURANGWA Pacifique\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacifiquem%2Fnode-async-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpacifiquem%2Fnode-async-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacifiquem%2Fnode-async-handler/lists"}