{"id":22450547,"url":"https://github.com/bergos/set-link","last_synced_at":"2025-08-01T23:31:48.470Z","repository":{"id":57356919,"uuid":"106192800","full_name":"bergos/set-link","owner":"bergos","description":"Link header middleware for express with multiple value and attribute support","archived":false,"fork":false,"pushed_at":"2017-10-08T16:51:49.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-30T01:19:29.843Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/bergos.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":"2017-10-08T16:48:10.000Z","updated_at":"2017-10-08T16:49:44.000Z","dependencies_parsed_at":"2022-09-26T16:32:03.432Z","dependency_job_id":null,"html_url":"https://github.com/bergos/set-link","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergos%2Fset-link","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergos%2Fset-link/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergos%2Fset-link/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bergos%2Fset-link/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bergos","download_url":"https://codeload.github.com/bergos/set-link/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228413983,"owners_count":17915931,"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-12-06T05:16:39.502Z","updated_at":"2024-12-06T05:16:39.951Z","avatar_url":"https://github.com/bergos.png","language":"JavaScript","readme":"# set-link\n\n[![Build Status](https://travis-ci.org/bergos/set-link.svg?branch=master)](https://travis-ci.org/bergos/set-link)\n[![npm version](https://badge.fury.io/js/set-link.svg)](https://badge.fury.io/js/set-link)\n\nLink header middleware for express with multiple value and attribute support.\n\n## Usage\n\nThe middleware doesn't require any parameters.\nJust add it to the express app like this:\n\n```\nconst setLink = require('set-link')\n\nconst app = express()\n\napp.use(setLink)\n```\n\n`.setLink` must be called with the link IRI and the relationship:\n\n```\napp.use((req, res) =\u003e {\n  res.setLink('http://example.org/context', 'http://www.w3.org/ns/json-ld#context')\n\n  // Link: \u003chttp://example.org/context\u003e; rel=\"http://www.w3.org/ns/json-ld#context\"\n})\n```    \n\nIt's also possible to add additional attributes using a key value map:\n\n``` \napp.use((req, res) =\u003e {\n  res.setLink('http://example.org/context', 'http://www.w3.org/ns/json-ld#context', {\n    title: 'example title',\n    type: 'application/ld+json'\n  })\n  \n  // Link: \u003chttp://example.org/context\u003e; rel=\"http://www.w3.org/ns/json-ld#context\"; title=\"example title\"; type=\"application/ld+json\"\n})\n```\n\nIf there is already a link header, the new one will be appended:\n\n```\napp.use((req, res, next) =\u003e {\n  res.set('link', '\u003chttp://example.org/api\u003e; rel=\"http://www.w3.org/ns/hydra/core#apiDocumentation\"')\n  res.setLink('http://example.org/context', 'http://www.w3.org/ns/json-ld#context')\n\n  // Link: \u003chttp://example.org/api\u003e; rel=\"http://www.w3.org/ns/hydra/core#apiDocumentation\", \u003chttp://example.org/context\u003e; rel=\"http://www.w3.org/ns/json-ld#context\"\n})\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbergos%2Fset-link","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbergos%2Fset-link","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbergos%2Fset-link/lists"}