rest-schema-table

3.1.1 • Public • Published

rest-schema-table

A table of contents for your REST service schema

Example

var RestSchemaTable = require("rest-schema-table");

var table = RestSchemaTable();
table.multiSet('/foo/:bar', {
  'GET': {
    'requestSchema': { ... },
    'responseSchema': { ... }
  }
});

//  {
//      'GET /foo/:bar': {
//          request: { ... },
//          response: { ... }
//      }
//  }
console.log('obj', table.toJSON());

Motivation

SchemaTable is an in memory data structure that defines the interface of any network server.

It currently encodes arbitrarly named operations which have requests and responses.

By convention it's recommended that you encode REST semantics by naming your operations as "{HTTP_METHOD} {HTTP_URL_PATTERN}". i.e. your server has a set of operations that are methods on resources.

The requestSchema and responseSchema are arbitrary.

Installation

npm install rest-schema-table

Tests

npm test

Contributors

  • Raynos

MIT Licenced

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.1.1
    14
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.1.1
    14
  • 3.1.0
    1
  • 3.0.0
    1
  • 2.0.0
    1

Package Sidebar

Install

npm i rest-schema-table

Weekly Downloads

5

Version

3.1.1

License

none

Last publish

Collaborators

  • raynos