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

Readme

Keywords

none

Package Sidebar

Install

npm i rest-schema-table

Weekly Downloads

4

Version

3.1.1

License

none

Last publish

Collaborators

  • raynos