{"id":22332378,"url":"https://github.com/dextermb/next-method","last_synced_at":"2026-04-27T23:39:21.396Z","repository":{"id":54935369,"uuid":"331126893","full_name":"dextermb/next-method","owner":"dextermb","description":"next-method's goal is to make it easier to interact with Next's API routes by providing a wrapper around the request method. A simplistic, focused, and minimal interface.","archived":false,"fork":false,"pushed_at":"2021-01-22T15:52:18.000Z","size":108,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"canary","last_synced_at":"2025-10-13T16:43:54.579Z","etag":null,"topics":["next","nextjs","rest-api"],"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/dextermb.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}},"created_at":"2021-01-19T22:29:12.000Z","updated_at":"2021-01-22T15:52:21.000Z","dependencies_parsed_at":"2022-08-14T07:00:45.882Z","dependency_job_id":null,"html_url":"https://github.com/dextermb/next-method","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dextermb/next-method","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dextermb%2Fnext-method","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dextermb%2Fnext-method/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dextermb%2Fnext-method/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dextermb%2Fnext-method/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dextermb","download_url":"https://codeload.github.com/dextermb/next-method/tar.gz/refs/heads/canary","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dextermb%2Fnext-method/sbom","scorecard":{"id":338788,"data":{"date":"2025-08-11","repo":{"name":"github.com/dextermb/next-method","commit":"5e4f358182ce8981e9261f431975d9f651ae1ba9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"28 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T05:18:35.690Z","repository_id":54935369,"created_at":"2025-08-18T05:18:35.690Z","updated_at":"2025-08-18T05:18:35.690Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32360116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["next","nextjs","rest-api"],"created_at":"2024-12-04T04:17:27.370Z","updated_at":"2026-04-27T23:39:21.380Z","avatar_url":"https://github.com/dextermb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🕵🏻‍♂️ Next Method\n\n\u003cimg alt=\"\" src=\"https://badgen.net/bundlephobia/minzip/next-method\"\u003e\n\u003cbr /\u003e\n\n`next-method`'s goal is to make it easier to interact with [Next][next]'s [API routes][next-api] by providing a wrapper around the [request method][request-method]. A simplistic, focused, and minimal interface.\n\n## Contents\n\n* [Installation](#installation)\n* [Usage](#usage)\n  * [Middleware](#middleware)\n  * [Methods](#methods)\n  * [Catching missing methods](#catching-missing-methods)\n\n\n## Installation\n\nInstall using either NPM, Yarn, or a package manager of your choosing.\n\n```bash\nnpm i next-method\n# or\nyarn add next-method\n```\n\n## Usage\n\n`next-method` is designed to be used within [Next][next]'s [API routes][next-api]. After creating yourself an API endpoint you can then start working with it.\n\n```js\nconst m = require('next-method')\n\nmodule.exports = (\n  m.get((req, res) =\u003e {\n    res.send('Hello, world!')\n  })\n)\n```\n\nIn this minimal example we're accepting `GET` requests to our endpoint. Once the endpoint is hit we either send the expected `GET` response or we throw an exception.\n\n### Middleware\n\nAdding middleware to any method is simple by making use of the `use` function, or the fact that methods can contain multiple handlers.\n\n```js\nconst m = require('next-method')\n\nmodule.exports = (\n  m\n    .use((req, res, next) =\u003e {\n      // Check for user authentication\n      if (user === null) {\n        return res.status(401).end()\n      }\n\n      return next()\n    })\n    .post((req, res) =\u003e {\n\n      // Create object\n      storeObject()\n\n      res.status(201)\n    })\n    .get((req, res) =\u003e {\n\n      // Get object details\n      const details = {}\n\n      res.json(details)\n    })\n)\n\n// or\n\nmodule.exports = (\n  m\n    .post([\n      (req, res, next) =\u003e {\n        // Verify post data\n        if (data === 'bad') {\n          return res.status(422).json({ errors: 'Bad data provided' })\n        }\n\n        return next()\n      },\n      (req, res) =\u003e {\n\n        // Create object\n        storeObject()\n\n        res.status(201)\n      }\n    ])\n    .get((req, res) =\u003e {\n\n      // Get object details\n      const details = {}\n\n      res.json(details)\n    })\n)\n```\n\n_In the examples above we make use of the `next` function that is provided as the third argument. This tells `next-method` to process the next handler._\n\n### Methods\n\n`next-method` supports all HTTP methods that the user is expected to come across such as:\n\n* `get`\n* `post`\n* `patch`\n* `put`\n* `delete`\n\nEach of these methods accept multiple handlers so can be processed in stages.\n\n### Catching missing methods\n\nWhen a request has been made and the method is not defined, such as in the example below: `put`, an exception will be thrown.\n\nThere are many ways to catch and handle the exception, but we provide a custom error object that provides the: request, response, and method.\n\n```js\nconst m = require('next-method')\n\nconst authenticated = require('~/middleware/authenticated')\nconst action = require('~/actions/user')\n\nmodule.exports = (\n  m\n    .use(authenticated)\n    .post(action.create)\n    .patch(action.update)\n    .delete(action.remove)\n    .get(action.retrieve)\n    .catch(({ res, method }) =\u003e {\n      res.status(422).json({ error: `${method} is not supported` })\n    })\n)\n```\n\n[next]: https://nextjs.org\n[next-api]: https://nextjs.org/docs/api-routes/introduction\n[request-method]: https://nodejs.org/api/http.html#http_request_method\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdextermb%2Fnext-method","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdextermb%2Fnext-method","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdextermb%2Fnext-method/lists"}