Example API Adapters Package
This package provides sample api adapters for the JSONPlaceholder website that work with two different http libraries: axios
and node-fetch
.
Installation
pnpm i @joe-sh/pnpm-api-adapters
axios
Usage
When using the axios
adapters, you must also install axios
.
pnpm i axios
const adapter = require('@joe-sh/pnpm-api-adapters/main.axios.js');
adapter('todos/1').then((resp) => console.log(resp));
node-fetch
Usage
When using the node-fetch
adapters, you must also install node-fetch
.
pnpm i node-fetch
const adapter = require('@joe-sh/pnpm-api-adapters/main.fetch.js');
adapter('todos/1').then((resp) => console.log(resp));