npm.io
0.6.0 • Published 10 years ago

apsmee

Licence
MIT
Version
0.6.0
Deps
3
Vulns
10
Weekly
0

Apsmee

Currently in development.

Apsmee is a simple schema based api client over Superagent. It works with browserify and webpack.

Install

NPM

npm install apsmee
From source
git clone git@github.com:refast/apsmee.git apsmee
cd apsmee
npm install
npm run build

Usage example

Simple github client
const ApiClient = require('apsmee');


const githubSchema = {
  user: {
    getByName: { path: '/users/:name' },
  },
};

const githubClient = new ApiClient({
  host: 'https://api.github.com',
  schema: githubSchema,
});

const request = githubClient.user.getByName({ name: 'refast' });
request.then(response => {
  console.log(response.body);
});
request.catch(err => {
  console.log(err.status);
});