8000 GitHub - frankdilo/leef-js: 🍃 Lightweight HTTP client based on fetch with an axios-like API
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

frankdilo/leef-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍃 Leef

CI NPM version Bundle size (minified + g-zipped)

⚠️ This is currently a work-in-progress. I am learning TypeScript as I go!

Lightweight, type-safe HTTP client based on Fetch API, with an API similar to axios.

Installation

npm install leef-js
yarn add leef-js

Basic Usage

import leef from "leef-js";

const res = await leef.get("https://api.github.com/users/frankdilo");

console.log(res.data.login); // => "frankdilo"
console.log(res.status); // => 200

Methods

leef.get(url, options);
leef.post(url, data, options);
leef.put(url, data, options);
leef.patch(url, data, options);
leef.delete(url, options);
leef.head(url, options);
leef.options(url, options);

Build and instance

import leef from "leef-js";

const api = leef.instance({
  baseURL: "https://api.example.com"
  headers: {
    Authorization: `Bearer ${process.env.AUTH_TOKEN}`,
  },
});

await api.get("/users");

Options

  • baseURL
  • headers
  • timeout
  • bodySerializer
  • defaultContentType

About

🍃 Lightweight HTTP client based on fetch with an axios-like API

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0