selfapi.js
function API (parameters) {
  // Own API resource prefix (e.g. '/resource').
  this.path = parameters.path || null;

  // Own documentation.
  this.title = parameters.title || null;
  this.description = parameters.description || null;

  // Own test setup functions.
  this.beforeEachTest = parameters.beforeEachTest || null;
  this.afterEachTest = parameters.afterEachTest || null;

  // Parent API resource (or root server app).
  this.parent = parameters.parent || null;

  // API sub-resources (API instances) by relative path (e.g. '/subresource').
  this.children = {};

  // Own request handlers (handler parameters) by method (e.g. 'post').
  this.handlers = {};
}
function API (parameters) {
  // Own API resource prefix (e.g. '/resource').
  this.path = parameters.path || null;

  // Own documentation.
  this.title = parameters.title || null;
  this.description = parameters.description || null;

  // Own test setup functions.
  this.beforeEachTest = parameters.beforeEachTest || null;
  this.afterEachTest = parameters.afterEachTest || null;

  // Parent API resource (or root server app).
  this.parent = parameters.parent || null;

  // API sub-resources (API instances) by relative path (e.g. '/subresource').
  this.children = {};

  // Own request handlers (handler parameters) by method (e.g. 'post').
  this.handlers = {};
}
function API ( parameters ) { // Own API resource prefix (e.g. '/resource'). this . path = parameters . path || null ; // Own documentation. this . title = parameters . title || null ; this . description = parameters . description || null ; // Own test setup functions. this . beforeEachTest = parameters . beforeEachTest || null ; this . afterEachTest = parameters . afterEachTest || null ; // Parent API resource (or root server app). this . parent = parameters . parent || null ; // API sub-resources (API instances) by relative path (e.g. '/subresource'). this . children = { } ; // Own request handlers (handler parameters) by method (e.g. 'post'). this . handlers = { } ; }
Simple, self-documenting and self-testing API system.
Simple self - documenting and self - testing API system .