Skip to content
This repository has been archived by the owner on Jun 11, 2023. It is now read-only.

will123195/idiot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

idiot

A simple JSON REST client

  • Lightweight for the browser and Node.js
  • Supports Promises and callbacks

Build Status

Install

npm install --save idiot

Usage

const client = require('idiot')({
  baseUrl: 'http://localhost:8080/api'
});

return client.get('/movies').then(data => {
  // got a 2xx response from http://localhost:8080/api/movies
});

Documentation

new Idiot( options )

  • options {Object}
    • baseUrl {String} (required) each request url is formed by appending the uri to this value
    • Promise {Function} (optional) specify your own Promise library

client.delete( uri, [query], [cb] )

  • uri {String}
  • query {Object} (optional) querystring values
  • cb {Function} (optional) callback

client.get( uri, [query], [cb] )

  • uri {String}
  • query {Object} (optional) querystring values
  • cb {Function} (optional) callback

client.patch( uri, body, [query], [cb] )

  • uri {String}
  • body {Object}
  • query {Object} (optional) querystring values
  • cb {Function} (optional) callback

client.post( uri, body, [query], [cb] )

  • uri {String}
  • body {Object}
  • query {Object} (optional) querystring values
  • cb {Function} (optional) callback

client.put( uri, body, [query], [cb] )

  • uri {String}
  • body {Object}
  • query {Object} (optional) querystring values
  • cb {Function} (optional) callback

client.request( options, [cb] )

  • options
    • method
    • uri
    • body
    • query
    • aborter
  • cb (optional)

About

A simple JSON REST JavaScript dumb-client

Resources

Stars

Watchers

Forks

Packages

No packages published