1.0.0 • Published 11 months ago
@narisolutions/request v1.0.0
Warning!
This library is quite fresh and still under development.
Currently, it supports only one type of authentication method, which is Firebase JWT token.
This library is intended to be simple replacement for axios. It's much smaller in size and supports most basic needs for handling api requests.
Please note, it's planned to make this library more sophisticated in time.
Usage
import { RequestHandler } from "@narisolutions/request";
const api = new RequestHandler( { baseURL: "https://api.example.com/v1", ... } );
const getUsers = () => {
try {
const users = await api.get("/users");
}catch(e) {
...
}
}TypeScript
import { RequestHandler } from "@narisolutions/request";
const api = new RequestHandler( { baseURL: "https://api.example.com/v1", ... } );
type User = {
name: string;
age: number;
}
const getUsers = () => {
try {
const users = await api.get<User[]>("/users");
}catch(e) {
...
}
}1.0.0
11 months ago