A tiny (~1.8KB gzipped) wrapper built around fetch with an intuitive syntax.
npm i wretch
yarn add wretch
pnpm add wretch
bun add wretch
<script src="https://unpkg.com/wretch"></script>
Build beautiful, chainable HTTP requests in seconds
wretch()
See all the pieces come together in one beautiful chain
import wretch from "wretch"
const user = await wretch("https://jsonplaceholder.typicode.com/users")
.json({ name: "John Doe", email: "john@example.com" })
.post()
.notFound(err => console.log("User not found"))
.error(500, err => console.log("Server error"))
.json()
console.log(user)