mi-causa
v0.1.0-alpha.14
Published
A Promise based fetch wrapper
Readme
mi-causa
Promise based Fetch wrapper.
Node js
const { createHttp } = require('mi-causa')
/** @type {import('mi-causa').Config} */
const config = {
baseURL: 'https://dummyjson.com'
}
const http = createHttp(config)
http
.get('/posts/1')
.then((response) => response.json())
.then((data) => {
console.log(data)
})Typescript
import { createHttp, type Config } from 'mi-causa'
const config: Config = {
baseURL: 'https://dummyjson.com/'
}
let api = createHttp(config)
api
.get('/products')
.then((data) => data.json())
.then((data) => console.log(data))