{"id":15497519,"url":"https://github.com/bcomnes/p-connect","last_synced_at":"2025-10-28T04:09:43.809Z","repository":{"id":35039027,"uuid":"199486553","full_name":"bcomnes/p-connect","owner":"bcomnes","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-24T14:16:37.000Z","size":50,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-24T00:50:09.482Z","etag":null,"topics":[],"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/bcomnes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["bcomnes"],"custom":["https://bret.io"]}},"created_at":"2019-07-29T16:11:01.000Z","updated_at":"2021-12-28T14:03:29.000Z","dependencies_parsed_at":"2022-08-08T04:01:10.041Z","dependency_job_id":"9f6643d9-17dd-4e99-9ad6-253a2b683a7d","html_url":"https://github.com/bcomnes/p-connect","commit_stats":{"total_commits":53,"total_committers":3,"mean_commits":"17.666666666666668","dds":0.339622641509434,"last_synced_commit":"6284c755f1027bf1588a54e031ff748f830fcfc8"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/bcomnes/p-connect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fp-connect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fp-connect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fp-connect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fp-connect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcomnes","download_url":"https://codeload.github.com/bcomnes/p-connect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcomnes%2Fp-connect/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260281568,"owners_count":22985629,"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":[],"created_at":"2024-10-02T08:39:14.739Z","updated_at":"2025-10-28T04:09:38.773Z","avatar_url":"https://github.com/bcomnes.png","language":"JavaScript","funding_links":["https://github.com/sponsors/bcomnes","https://bret.io"],"categories":[],"sub_categories":[],"readme":"# p-connect\n\nConverts connect style middleware, routes, errorRoutes to a promise.  Also supports `http-hash-route` style routes.\n\n```console\nnpm install p-connect\n```\n\n## Usage\n\n``` js\nconst { pMiddleware, route } = require('p-connect')\nconst bodyParser = require('body-parser')\nconst pJson = pMiddleware(bodyParser.json())\n\nconst asyncRoute = async (req, res) =\u003e {\n   await pJson(req, res)\n   // req.body is now populated\n}\n\napp.use(route(asyncRoute))\n```\n\n## API\n\n### `pMiddleware(connectMiddleware)`\n\nConvert a callback style middleware to work inside of an asynchronous environment.  Does not return any value, it will just throw if an error occures inside the middleware.\n\n### `route(asyncConnectRoute)`\n\nConverts an async connect route to a callback connect route.\n\n`connectRoute(req, res, next)` should return a promise.  `route(connectRoute) = (req, res, next) =\u003e {...}` returns a connect style callback middleware that calls next(err) when asyncConnectRoute throws.  You should still call the `next` callback in async middleware if you want to keep the middleware chain moving.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcomnes%2Fp-connect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcomnes%2Fp-connect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcomnes%2Fp-connect/lists"}