1.0.3 • Published 7 years ago

simple-json-api-wrapper v1.0.3

Weekly downloads
5
License
ISC
Repository
-
Last release
7 years ago

Description

This is just a simple package that wraps the fetch API, and returns JSON.

Usage

There are three methods (get, post, put), wich all return a promise. Arguments:

url: A string to the url or endpoint you want to call. body: A object containing the info you would like to POST or PUT.

Example

import Api from "simple-json-api-wrapper";

// All methods return a promise.
const promise = Api.get(url);

promise.then((json) => {
  // Do something with JSON.
  console.log(json);
});

/*
* @param url {String} The url you are trying to call.
* @param body {Object} A object of the data you would like to POST or PUT.
*/ 

Api.post(url, body);

Api.put(url, body);
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago