{"id":13779838,"url":"https://github.com/koajs/resourcer-docs","last_synced_at":"2025-10-19T13:31:38.535Z","repository":{"id":21420028,"uuid":"24738122","full_name":"koajs/resourcer-docs","owner":"koajs","description":"[MAINTAINERS WANTED] Simple app that generates documentation for routes mounted using koa-resourcer.","archived":false,"fork":false,"pushed_at":"2024-09-15T21:53:34.000Z","size":35,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":40,"default_branch":"master","last_synced_at":"2024-10-29T15:32:19.588Z","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/koajs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"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}},"created_at":"2014-10-02T21:50:22.000Z","updated_at":"2024-07-18T22:35:33.000Z","dependencies_parsed_at":"2023-12-14T10:01:20.981Z","dependency_job_id":"c4fba7f1-14ea-45ba-9302-4c41b2d35c49","html_url":"https://github.com/koajs/resourcer-docs","commit_stats":{"total_commits":21,"total_committers":3,"mean_commits":7.0,"dds":0.2857142857142857,"last_synced_commit":"5ac1d1d64e4b7aa077277515072af1dc26477cd7"},"previous_names":["pebble/koa-resourcer-docs"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Fresourcer-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Fresourcer-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Fresourcer-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koajs%2Fresourcer-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koajs","download_url":"https://codeload.github.com/koajs/resourcer-docs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237133598,"owners_count":19260507,"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-08-03T18:01:09.771Z","updated_at":"2025-10-19T13:31:33.230Z","avatar_url":"https://github.com/koajs.png","language":"JavaScript","funding_links":[],"categories":["Middleware"],"sub_categories":[],"readme":"#resourcer-docs\n\nA simple documentation generator for [koa-resourcer](https://github.com/koajs/resourcer).\n\n## Use\nIn your app:\n```js\nvar koa = require('koa');\nvar join = require('path').join;\nvar resource = require('koa-resourcer');\nvar docs = require('koa-resourcer-docs');\n\nvar app = koa();\nresource(app, join(__dirname, 'resources'), docs.addRoute);\napp.listen();\n```\n\nIn each resource app:\n```js\nvar koa = require('koa');\nvar Router = require('koa-joi-router');\n\nvar router = Router();\nvar app = module.exports = koa();\n\n// Expose routes to documentation generator\napp.routes = router.routes;\n\n// Define some routes...\n\napp.use(router.middleware());\n```\n\n## Configuration\nAdd a description to the route config:\n```js\nrouter.get('/', {meta: {description: 'Home page'}}, function* () {\n  this.body = \"Home page under construction since 2009\";\n});\n```\n\nHide a resource by not exposing routes:\n```js\n// Expose routes to documentation generator\n//app.routes = router.routes;\n```\n\nHide individual routes in a resource app from documentation by adding `hide: true` to route metadata:\n```js\n// Documented route:\nrouter.get('/', {meta: {description: 'Main route'}}, function* () {\n  this.body = 'Hello world';\n});\n\n// Hidden route:\nrouter.get('/secretRoute', {meta: {description: 'Nobody here but us chickens.', hide: true}}, function* () {\n  this.body = 'This is a hidden world';\n});\n```\n\nAdd middleware to intercept requests before routing to docs:\n```js\nvar docs = require('koa-resourcer-docs');\n\n// Respond with 404 if not in a development environment\ndocs.useRequestHandler(function* (next) {\n  if (process.env.NODE_ENV === 'development') {\n    return yield next;\n  }\n  this.throw(404);\n});\n```\n\nFor backwards compatibility \"hide\" and \"description\" on the koa-joi-router configuration object are still supported but **no longer recommended** since they pollute the namespace of the configuration.\n\n## Installation\n```\nnpm install koa-resourcer-docs --save\n```\n\n## Sponsored by\n\n[Pebble Technology!](https://www.pebble.com)\n\n## LICENSE\n\n[MIT](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoajs%2Fresourcer-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoajs%2Fresourcer-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoajs%2Fresourcer-docs/lists"}