@mendora/misport
v2.0.1
Published
Best Alternate to axios?
Readme
Misport
Version: 2.0.0
Description: Best Alternate to Axios? Yes. A tiny, flexible HTTP request library for Node.js using the native fetch.
📦 Installation
npm install misport✨ Features
Minimal and lightweight, no heavy dependencies.
Simple API similar to Axios (
get,post,put,delete,patch).Supports:
- Query parameters
- Request body
- Follow/disable redirects
- Response type selection (
json,plaintext,html)
Uses Node's built-in
fetch(Node.js 18+)
🚀 Usage
Import
const misport = require('@mendora/misport');GET Request
(async () => {
const data = await misport.get("https://jsonplaceholder.typicode.com/posts", {
query: { userId: 1 },
type: "json"
});
console.log(data);
})();POST Request
(async () => {
const post = await misport.post("https://jsonplaceholder.typicode.com/posts", {
body: { title: "foo", body: "bar", userId: 1 }
});
console.log(post);
})();PUT Request
(async () => {
const updated = await misport.put("https://jsonplaceholder.typicode.com/posts/1", {
body: { title: "updated title" }
});
console.log(updated);
})();DELETE Request
(async () => {
const result = await misport.delete("https://jsonplaceholder.typicode.com/posts/1");
console.log(result);
})();🛠 API Reference
All methods:
misport.get(url, options)
misport.post(url, options)
misport.put(url, options)
misport.delete(url, options)
misport.patch(url, options)Options:
| Option | Type | Default | Description |
| ---------------- | ------------- | -------- | ------------------------------------------ |
| body | Object/String | null | Request body (auto JSON if object) |
| query | Object | null | Query parameters |
| followRedirect | Boolean | true | Whether to follow redirects |
| type | String | "json" | Response type: json, plaintext, html |
📄 License
HydDNSMS
