UNPKG

torc-api

Version:

torc-api is a lightweight wrapper to simplify HTTP requests

12 lines (11 loc) 308 B
import { API } from './API.js'; const pokeApi = new API({ url: 'https://pokeapi.co/api/v2/pokemon' }); async function fetchPokemon(pokemonName) { const data = await pokeApi.get({ endpoint: pokemonName }); return data; } fetchPokemon('ditto').then(data => console.log('data:', data));