3.2.2 • Published 5 years ago

bedrock-docs v3.2.2

Weekly downloads
76
License
-
Repository
github
Last release
5 years ago

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
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.

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.

3.2.2

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.0

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago