@zemd/http-client
v3.0.1
Published
A lightweight framework to build your custom fetch
Downloads
17
Readme
@zemd/http-client
This is a small, zero requirements and simple library for creating HTTP clients. It uses simple approach by providing an api around native fetch(but can be overridden by setting your calling mechanism) in a configurable and functional manner.
Installation
bun add @zemd/http-client
npm install @zemd/http-client
yarn install @zemd/http-client
pnpm add @zemd/http-client
Usage
import { compose, method, json } from "@zemd/http-client";
const myfetch = compose([method("POST"), json()], fetch);
const resp = await myfetch("https://example.com");
As you can see the idea is very simple, and real power comes when you start composing different configurations together and creating your client.
A real example you can find in ../apis/
folder.
An example of how you can use the library in your project see src/example.ts
License
@zemd/http-client
released under the Apache 2.0 license