fetchtastic
TypeScript icon, indicating that this package has built-in type declarations

0.3.4 • Public • Published

🌩️ Fetchtastic

Small wrapper around fetch designed to perform more predictable and type-safe network requests.

MIT GitHub issues GitHub commit activity npm npm

Features
🪶 Lightweight Less than 3KB gzipped
🧩 Composable Safely reuse previous configurations
Intuitive Clean and easy to use API
🛡️ Type safe Strongly typed, written in TypeScript
🛠️ Isomorphic Compatible with modern browsers, Node.js and Deno
Well Tested Covered by unit tests

📖 Documentation

Visit fetchtastic-docs.vercel.app to view the full documentation.

Getting Started

npm

npm install fetchtastic

pnpm

pnpm add fetchtastic

yarn

yarn add fetchtastic

deno

import { fetchtastic } from 'https://deno.land/x/fetchtastic/lib/mod.ts';

Basic usage

const api = new Fetchtastic('https://jsonplaceholder.typicode.com')
  .setOptions({ cache: 'default', mode: 'cors' })
  .headers({
    Accept: 'application/json',
    'Content-Type': 'application/json',
  });

const blogData = await api
  .searchParams({ page: 1, per_page: 12 })
  .get('/posts')
  .json(PostSchema.parse);

await api.post('/albums', { title: 'My New Album' }).resolve();

Contributing

Contributions are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have a smooth experience.

Package Sidebar

Install

npm i fetchtastic

Weekly Downloads

173

Version

0.3.4

License

MIT

Unpacked Size

135 kB

Total Files

9

Last publish

Collaborators

  • veracoecheafrancisco