# bedrock-docs

> Bedrock docs

Latest version **3.2.2** (published 2019-11-08) · 0 weekly downloads

## Install

```sh
npm install bedrock-docs
pnpm add bedrock-docs
yarn add bedrock-docs
bun add bedrock-docs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.2 |
| Published | 2019-11-08 |
| First published | 2015-01-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 3 |
| Unpacked size | 420 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Digital Bazaar, Inc. |
| Maintainers | davidlehn, dlongley, mattcollier, msporny |
| Keywords | bedrock |

## Links

- npm: https://www.npmjs.com/package/bedrock-docs
- Repository: https://github.com/digitalbazaar/bedrock-docs
- Issues: https://github.com/digitalbazaar/bedrock-docs/issues
- npm.io page: https://npm.io/package/bedrock-docs

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^2.6.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.5
- [raml2html](https://npm.io/package/raml2html.md) ^7.4.0

## Recent versions

- 3.2.2 (latest) — 2019-11-08
- 3.2.1 — 2019-11-07
- 3.2.0 — 2019-10-11
- 3.1.0 — 2018-11-27
- 3.0.0 — 2018-09-17
- 2.2.3 — 2018-06-27
- 2.2.2 — 2018-03-07
- 2.2.1 — 2018-01-18
- 2.2.0 — 2017-11-10
- 2.1.1 — 2017-07-27
- 2.1.0 — 2017-05-04
- 2.0.2 — 2016-08-28
- 2.0.1 — 2016-04-15
- 2.0.0 — 2016-03-03
- 1.0.1 — 2015-05-07
- … 4 more at https://npm.io/package/bedrock-docs/versions

## README

# bedrock-docs

A [bedrock][] module that adds custom documentation and REST API documentation
support to a site. Documentation is hosted at `/docs`. API documentation can be
generated with [RAML][] and [raml2html][] by using the documentation API to
annotate REST endpoints.

## Requirements

- npm v3+

## Quick Examples

```
npm install bedrock-docs
```

```js
var brDocs = require('bedrock-docs');

bedrock.events.on('bedrock-express.configure.routes', addRoutes);

function addRoutes(app) {
  app.get('/my/resource', function(req, res, next) {
    // ...
  });
  brDocs.annotate.get('/my/resource', {
    displayName: 'My Resource',
    description: 'Get My Resource.',
    responses: {
      200: {
        'application/ld+json': {
          'example': 'examples/my-resource.jsonld'
        }
      }
    }
  });
}
```

## Configuration

For documentation on configuration, see [config.js](./lib/config.js).

## API

### getRaml(method, path, indent, callback(err, ramlSnippet))

Retrieve a RAML annotation for a particular method and path. The indentation
level must be provided. Use '{' and '}' for path variables ("/my/{id}"). The
result RAML string can be injected into a master RAML file.

### loadFile(section, paths, vars, callback)

Loads a documentation file from disk, making the appropriate template
replacements.

### document(method, path, doc)

Documents a particular method and path of the system. Prefix path variables
with ':' ("/my/:id"). The `doc` object is in [RAML][] format.

### annotate.METHOD(path, docs)

Aliases for `document(METHOD, path, doc)` for `get`, `post`, `put`, `patch`,
and `delete`.

[bedrock]: https://github.com/digitalbazaar/bedrock
[RAML]: http://raml.org/
[raml2html]: https://github.com/kevinrenskers/raml2html

---
_Source: https://npm.io/package/bedrock-docs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
