Skip to content

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

License

Notifications You must be signed in to change notification settings

fveracoechea/fetchtastic

Repository files navigation

🌩️ Fetchtastic

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

GitHub issues GitHub commit activity bundle.js 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 fveracoechea.github.io/fetchtastic to view the full documentation.

⚡Getting Started

npm install fetchtastic

Fetchtastic is built on standard web APIs and runs everywhere fetch is available.

  • Modern browsers
  • Node.js >= v18
  • Deno
  • Service Workers
  • Netlify Edge Functions
  • Vercel Edge Functions
  • and more...

Basic usage

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

const blogPosts = await api
  .get('/posts')
  .setSearchParams({ page: 1, per_page: 12 })
  .json();

await api.url('/albums').post({ 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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •