Class: API

API

new API(lifted, dataScrub, onsuccess, onfailure)

lib/API.js, line 21

Represent a lifted API

Instances of this class are created internally for you. You don't need to use this constructor directly.

Name Type Description
lifted external:lift-it.Lifted
dataScrub Array.<RegExp>
onsuccess function nullable
onfailure function nullable

Members

endpointByUrlObject.<Endpoint>

The map from url to an Endpoint instance

endpointsArray.<Endpoint>

maxVersionnumber

minVersionnumber

routerexternal:express.Router

versionsArray.<string>

The list of supported versions, ordered from oldest to newest. Example: ['v3', 'v4']

Methods

run(url, body, runInfo, callback)

lib/API.js, line 83

Execute an endpoint in this api

Name Type Default Description
url string

like '/v1/user/create' or '/v-last/user/create'

body Object
runInfo Object {} optional

data available as process.domain.runInfo. See more info in run-it module

Name Type Default Description
beginTime number Date.now() optional
requestId string genId() optional
callback function

async cb(out)