@aiwizo/api-utils

fetch wrapper

Usage no npm install needed!

<script type="module">
  import aiwizoApiUtils from 'https://cdn.skypack.dev/@aiwizo/api-utils';
</script>

README

@aiwizo/api-utils

Minimalistic fetch wrapper for front end applications.

Installation

npm install @aiwizo/api-utils

Setup

Requires environment variables:

  • NODE_ENV, string "development" or "production"
  • REACT_APP_BACKEND_PORT, number eg 8000

Basic usage

import { GET, POST } from '@aiwizo/api-utils';

GET((error, data) => {
 // Do something
}, '/some/endpoint');

POST((error, data) => {
// Do something
}, '/some/endpoint', {foo: 'bar'});