create API service.
// basic
const api = new API('web', 'http://localhost:8081', {});
api.doGet('');
// via python
const api = new API('residents', 'http://localhost:8113', {});
api.doGet('123'); // http GET :8113/residents/123
// proxy server
const api = new API('web', 'http://localhost:8081', {}, null, proxy);
api.doGet('');
type in endpoint
base endpoint (support ONLY http, https)
Optional
headers: APIHeaderscommon headers.
Optional
client: APIServiceClientreal api-client to use (or use proxy, or create default)
Optional
proxy: ApiHttpProxyproxy-service to use if there is no client (or use backbone server)
Protected
clientProtected
endpointProtected
headersProtected
typeStatic
APIServicerecorder of api-service client.
Static
Apirecorder of api-http-proxy client.
Static
Private
Proxyclass: TypedEndpoint
Static
Subuse sub-typed endpoint.
make api recorder of this service.
Optional
folder: stringbase folder (default ./logs
)
make a client for sub-typed endpoint.
sub-type path.
Optional
useRecord: booleanOptional
folder: stringStatic
buildhelper to make http client
Optional
headers: APIHeadersOptional
backbone: stringbackbone address like 'http://localhost:8081'
Optional
proxy: ApiHttpProxyGenerated using TypeDoc
class:
APIService