{"id":15572884,"url":"https://github.com/oada/well-known-json-js","last_synced_at":"2026-01-29T23:30:57.262Z","repository":{"id":21986149,"uuid":"25311091","full_name":"OADA/well-known-json-js","owner":"OADA","description":"Middleware for serving JSON Well-Known resources","archived":false,"fork":false,"pushed_at":"2023-05-18T17:45:01.000Z","size":3835,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-05T11:07:08.206Z","etag":null,"topics":["expressjs","javascript","json","middleware","well-known"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OADA.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":"2014-10-16T16:29:05.000Z","updated_at":"2022-04-06T21:36:12.000Z","dependencies_parsed_at":"2023-02-13T20:31:23.298Z","dependency_job_id":null,"html_url":"https://github.com/OADA/well-known-json-js","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OADA%2Fwell-known-json-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OADA%2Fwell-known-json-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OADA%2Fwell-known-json-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OADA%2Fwell-known-json-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OADA","download_url":"https://codeload.github.com/OADA/well-known-json-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246149891,"owners_count":20731405,"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":["expressjs","javascript","json","middleware","well-known"],"created_at":"2024-10-02T18:07:41.535Z","updated_at":"2026-01-29T23:30:57.244Z","avatar_url":"https://github.com/OADA.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build\nStatus](https://travis-ci.org/OADA/well-known-json-js.svg)](https://travis-ci.org/OADA/well-known-json-js)\n[![Coverage\nStatus](https://coveralls.io/repos/OADA/well-known-json-js/badge.svg?branch=master)](https://coveralls.io/r/OADA/well-known-json-js?branch=master)\n[![Dependency\nStatus](https://david-dm.org/oada/well-known-json-js.svg)](https://david-dm.org/oada/well-known-json-js)\n[![License](http://img.shields.io/:license-Apache%202.0-green.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)\n\n# well-known-json\n\n## Illustrative usage example\n\n```typescript\nimport express from 'express';\nimport wkj from 'well-known-json';\n\nconst app = express();\n\n// Each resource will be a separate JSON resource under the well-known endpoint\nconst resources = {\n  'foo/bar': {\n    // Will be at .well-known/foo/bar\n    a: 1,\n    b: 2,\n  },\n  'baz': {\n    // Will be at .well-known/baz\n    obj: {\n      // Function properties are evaluated for each response generated\n      now: function () {\n        return Date.now();\n      },\n      // String properties that look like relative URIs are converted to absolute URIs\n      uri: './relative/path',\n    },\n    // Other things become JSON normally\n    str: 'words here',\n  },\n};\n\n// Options for well-known-json middleware (and middlewares it uses)\nconst options = {\n  // Passed directly to cors middleware\n  cors: {\n    /* whatever you can give the cors middleware */\n  },\n  // Optional base for resolving relative URIs\n  // If omitted, wkj will use the protocol and host to which the request was sent\n  baseUri: 'http://example.org/foo',\n};\n\n// Create a middleware instance\nconst wkjMiddleware = wkj(resources, options);\n\n// Mount the middleware with express\napp.use(wkjMiddleware);\n\n// Add additional resources after creation\n// They will be merged with a prexisting resource with the same name\nwkjMiddleware.addResource('baz', {\n  more: 'stuff', // Add key more to baz\n  str: 'different words here', // Overwrite key str in baz from before\n});\n```\n\n## Features\n\n- Enables CORS (including pre-flight) for its corresponding JSON documents\n- Converts relative URIs to absolute\n- Can have functions \"in the documents\" which get evaluated for each request\n- Supports de-facto standard for reverse proxies (i.e. X-Forwarded-\\* headers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foada%2Fwell-known-json-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foada%2Fwell-known-json-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foada%2Fwell-known-json-js/lists"}