0.3.0 • Published 2 years ago

@enter000/api v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

package for handling api requests

Install

$ npm install @enter000/api

Usage

provides get, post, put

import API from '@enter000/api';

async function fetchData() {
  const response = await API.get(url, params, options);
  // do smth with response
}

fetchData();

//

function postData() {
  const response = await API.post(url, body, options, method = 'post[delete|put]');
  /// do smth with response
}

postData();

API

.get(url, params?, options?)

runs fetch request to specified url

params

Type: object\ Default: {}

Api.get('http://example.com');
//=>fetch('http://example.com')

Api.get('http://example.com', { count: 1, multiple: [1, 2] })
//=>fetch('http://example.com?count=1&multiple[]=1&multiple[]=2')

nullable values are omitted

0.3.0

2 years ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago