-
Notifications
You must be signed in to change notification settings - Fork 4
Legacy API: Development
API endpoints are implemented as a collection of components which work together to return the requested API object to the requesting client. The components of an endpoint are documented and explained in this section.
The API object itself is simply an object which defines the properties specified by the interface specification. API objects serve only as data containers, and do not define any methods (with the exception of a toJSON method, though in most cases defining that method is not necessary either).
To see examples of API object implementations, see any of lib/objects/*.js
The storage object is responsible for fetching the data needed to instantiate a API object, instating the object, and invoking the processing method passed to it by its caller.
To see examples of storage object implementations, see any of lib/storage/sqlite/*.js
The controller is a function which is responsible for collecting inputs from the requestor, passing the requestor's inputs to a fetch method of a storage object, and returning the API object instantiated by the storage method to the requestor
To see examples of controller implementations, see any of controllers/*.js