{"id":43856253,"url":"https://github.com/rdfjs-base/express-handler","last_synced_at":"2026-02-06T09:22:18.746Z","repository":{"id":53068433,"uuid":"178954741","full_name":"rdfjs-base/express-handler","owner":"rdfjs-base","description":"Handle incoming and outgoing RDF data in Express","archived":false,"fork":false,"pushed_at":"2025-11-22T21:55:29.000Z","size":139,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-22T23:23:23.616Z","etag":null,"topics":["content-type","express","javascript","middleware","parser","rdf"],"latest_commit_sha":null,"homepage":null,"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/rdfjs-base.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-04-01T22:10:44.000Z","updated_at":"2025-11-22T21:55:26.000Z","dependencies_parsed_at":"2024-06-19T02:53:12.609Z","dependency_job_id":"a4df8733-a584-41f7-8d3e-95aa133c2e56","html_url":"https://github.com/rdfjs-base/express-handler","commit_stats":null,"previous_names":["rdfjs/express-handler"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/rdfjs-base/express-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdfjs-base%2Fexpress-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdfjs-base%2Fexpress-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdfjs-base%2Fexpress-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdfjs-base%2Fexpress-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rdfjs-base","download_url":"https://codeload.github.com/rdfjs-base/express-handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rdfjs-base%2Fexpress-handler/sbom","scorecard":{"id":764987,"data":{"date":"2025-08-11","repo":{"name":"github.com/rdfjs-base/express-handler","commit":"010f321bf1128624a5c5aca1eac92c49891b7896"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/7 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yaml:1","Info: no jobLevel write permissions found"],"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":"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":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/rdfjs-base/express-handler/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/rdfjs-base/express-handler/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/rdfjs-base/express-handler/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/rdfjs-base/express-handler/test.yaml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/test.yaml:21","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"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":"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":"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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":"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":"SAST","score":3,"reason":"SAST tool is not run on all commits -- score normalized to 3","details":["Warn: 10 commits out of 27 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"}}]},"last_synced_at":"2025-08-23T00:31:55.334Z","repository_id":53068433,"created_at":"2025-08-23T00:31:55.334Z","updated_at":"2025-08-23T00:31:55.334Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29156562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T07:18:23.844Z","status":"ssl_error","status_checked_at":"2026-02-06T07:13:32.659Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["content-type","express","javascript","middleware","parser","rdf"],"created_at":"2026-02-06T09:22:17.734Z","updated_at":"2026-02-06T09:22:18.733Z","avatar_url":"https://github.com/rdfjs-base.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @rdfjs/express-handler\n\n[![build status](https://img.shields.io/github/actions/workflow/status/rdfjs-base/express-handler/test.yaml?branch=master)](https://github.com/rdfjs-base/express-handler/actions/workflows/test.yaml)\n[![npm version](https://img.shields.io/npm/v/@rdfjs/express-handler.svg)](https://www.npmjs.com/package/@rdfjs/express-handler)\n\nThe `@rdfjs/express-handler` middleware provides methods to parse incoming RDF data from request with content like `POST` or `PUT` requests.\nIt also provides methods to serialize outgoing RDF data.   \n\n## Usage\n\nThe package returns a factory function to create express middlewares.\n\n### Factory\n\nAdding it to all routes of the app would look like this:\n\n```\nimport express from 'express'\nimport rdfHandler from '@rdfjs/express-handler'\n\nconst app = express()\n\napp.use(rdfHandler())\n```\n\nThe factory accepts the following options:\n\n- `factory`: The factory used to create Dataset instances. Default: `require('rdf-ext')`\n- `formats`: An object with `parsers` and `serializers`, each given as `@rdfjs/sink-map`. Default: `require('@rdfjs/formats-common')`\n- `defaultMediaType`: If an unknown Content-Type is given, this media type will be used. Default: `undefined`\n- `baseIriFromRequest`: If `true`, will call [absolute-url](https://npm.im/absolute-url) to get the requested IRI and pass as base IRI to the parser.\n  It can also be a function `async (req) =\u003e string` which can be used to compute the base IRI for the parser.\n- `sendTriples`: If `true`, the RDF/JS Quads sent using `res.dataset()` or `res.quadStream()` are converted to triples (default graph). Default `undefined`.\n\n### Request\n\nRoutes following the RDF Handler can access the parsed Quads from the request as a Stream or Dataset.\nThe `req.dataset()` and `req.quadStream()` methods can be used for this.\nBut the methods are only attached if the request contains content in a type supported by one of the parsers.\nThe logic to access the Quads could look like this:\n\n```\napp.use((req, res) =\u003e {\n  if (!req.dataset) {\n    return res.status(406).end() // send 406 not acceptable if the content can't be parsed\n  }\n\n  const dataset = await req.dataset()\n})\n```\n\n`req.dataset()` requires `await` as it's an async method.\n`req.quadStream()` is a sync method.\nBoth methods accept an options object, which is forwarded to the parser.\n\n### Response\n\nThe RDF Handler middleware always attaches the `res.dataset()` and `res.quadStream()` methods.\nThe methods must be called with the Dataset or Stream, which should be sent.\nA second options object can be given, which will be forwarded to the serializer.\nSending a Dataset would look like this:\n\n```\napp.use((req, res) =\u003e {\n  await res.dataset(dataset)\n})\n```\n\nBoth methods are async and finished once the response was sent.\n\n### Attaching\n\nIf you don't know if `@rdfjs/express-handler` is used earlier in the application, it's possible to attach it dynamically.\nThat is useful inside of a middleware where you want to use an application RDF Handler instance and it's options, but fallback to a local instance if there is no RDF Handler earlier in the routes.\nThe `.attach()` function can be used.\n`await` must be used, as it's an async function. \n\n```\napp.use((req, res) =\u003e {\n  await rdfHandler.attach(req, res)\n\n  if (req.dataset) {\n    const dataset = await req.dataset()\n  }\n\n  await res.dataset(rdf.dataset())\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdfjs-base%2Fexpress-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdfjs-base%2Fexpress-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdfjs-base%2Fexpress-handler/lists"}