1.0.2 • Published 5 years ago
orsys-http-client v1.0.2
Orsys-HTTP-client
Available via:
- NPM:
npm install --save orsys-http-client
- YARN:
yarn add orsys-http-client
Usage
All you need to do is :
1- Create Instance of HTTPClient
const api = new HTTPClient(Store, {
baseURL: "http://localhost:8081/api",
})
2- Register the endpoints
api.registerEP('test', {
payload: {},
url: "/url/test",
})
3- Usage of the endpoints
api.fetch({ endpoint: 'test' }).then(function(result){
// do somthing with result
}).catch(function(error){
// error
})
OR
api.fetch({ endpoint: 'test' }, 'key')
// key: is the key in the store where the result will set