💸 Wings Node Api Client
Very basic API client for node environments to deal with the wings API. It is build on top of the node-fetch
library.
Usage
const { create } = require('@rexlabs/wings-node-api-client')
const api = create({ baseUrl: 'http://wings.test/api/rex/' })
api.setAuthToken('xxx');
api('Listings::search', args).then(res => {
console.log({ res })
});
The client instance (api
in the example above) is an executable function in itself, which will trigger a post request to the given path. The second argument is an optional data object that will be used for the body, the third argument can be any options that will override the default options passed into the create
call.
The client also comes with the following extra methods:
api.setHeader(headerKey, headerValue);
api.setAuthToken(token);
api.setOption(optionKey, optionValue);
api.setOptions({ optionKey: optionValue });
api.searchAll('Listings', args).then(res => {
console.log({ res })
});
Development
Install dependencies
$ yarn
Available Commands
$ yarn test
$ yarn test:watch
Legal
Copyright (c) 2018 Rex Software All Rights Reserved.