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 eg8000
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'});