2.0.2 • Published 2 years ago

fetch-api.json v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

fetch-api.json

Um simples módulo feito com intuito ajudar iniciantes a fazer requisições em APIs e sites, sem complicações.

Requer o Node.js versão equivalente ou superior à 14.0.0.


Instalação:

npm install fetch-api.json
yarn add fetch-api.json
pnpm add fetch-api.json

Exemplo:

const { get } = require('fetch-api.json');
get('https://nekos.life/api/v2/img/neko').then(data => console.log(data)) // {"url":"https://cdn.nekos.life/neko/neko230.jpg"}

Avançado:

  • Requisição em um site que retorna um texto ou obter o HTML de algum site.
const { get } = require('fetch-api.json');
get('https://pastebin.com/raw/iNau6zJZ', 'text').then(data => console.log(data)) // PasteBin API Check
  • Requisição em um site que retorna uma imagem
const { get } = require('fetch-api.json');
get('https://cdn.nekos.life/neko/neko230.jpg', 'buffer').then(data => console.log(data)) // < Buffer abcdef >
  • Requisição em um site que retorna JSON porém requer requisições POST
const { get } = require('fetch-api.json');
get('https://example.org/', 'json', 'POST').then(data => console.log(data))
2.0.2

2 years ago

2.0.1

2 years ago