node package manager

babyloania-api-client

Babyloania API Client

Service API Wrapper

Installation

$ npm install --save https://github.com/babyloania/api-client.git

How To Use

// Use default configuration
var config = {};
var babyloania = require("babyloania-api-client")(config);
 
// Auth Service methods
var Auth = babyloania.Auth;
 
// Post form login to retrieve user and token
Auth.login("arkka.d@gmail.com","12345", function(err, results){
    console.log("Get response from login endpoint")
    console.log(results);
}); 
 

For more sample, see https://github.com/babyloania/api-client-sandbox/

Configuration

Default package configuration, change whenever necessary.

// Default configuration
var config =
  {
      protocol: "http",
      hostname: "127.0.0.1",
      services: {
          auth: {
              endpoint: "auth",
              port: 3300
          },
          product: {
              endpoint: "products",
              port: 3400
          },
          customer: {
              endpoint: "customers",
              port: 3500
          },
          order: {
              endpoint: "orders",
              port: 3600
          }
      };