0.0.5 • Published 3 years ago

@codecraftkit/api-meteor v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

DEPRECATED

Code Craft - Finance Api

This package is a library that is used to make http requests to the Finance API.

INSTALLING

via npm

  • npm install cc-api

from source

  • git clone https://bitbucket.org/FinoCodeLab/cc-api.git

REQUIREMENTS

  • MeteorJS
  • NodeJs
  • Npm

HOW IS IT USED?

var api = new(require('cc-api'))({url: '', debug_mode: false});
OR
var ccApi = require('cc-api');
var api = new ccApi({key:'', url: '', debug_mode: false});
PARAMS
  • url: String, Endpoint ej: http://www.domine.com
  • key: String, Security key generated. Optional
  • debug_mode: Boolean, This parameter by default is false.

let url = '/my/route';
let data: {
    ...
};

api.get(url, data).then(res => {
    console.log(res);
}).catch(err => {
    console.log(err);
});
PARAMS
  • url: String, final part of the endpoint, ex: /my/route
  • data: Object

If you want to make a request to an endpoint other than the one entered in the initial configuration parameters, you can send the variable overwriteEndpoint: true within the same object "data". This parameter indicates that the endpoint will be replaced by the url that is being entered in the method. Ex:

let url = 'http://www.dominio.com/api/my/route';
let data: {
    overwriteEndpoint: true,
    ...,
    ...,
};

api.get(url, data).then(res => { console.log(res); }).catch(err => { console.log(err); });

NOTA: All methods use promises.

--------

### AVAILABLE METHODS

* GET
* POST
* PUT
* DELETE