rest-schema-table
v3.1.1
Published
A table of contents for your REST service schema
Downloads
10
Readme
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