A table of contents for your REST service schema
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());
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.
npm install rest-schema-table
npm test
- Raynos