UNPKG
torc-api
Version:
latest (1.1.8)
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0
torc-api is a lightweight wrapper to simplify HTTP requests
torc-api
/
dist
/
test.js
12 lines
(11 loc)
•
308 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
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));