@bundly/ares
v0.1.1
Published
HTTP client for calling REST APIs and seamlessly integrating Internet Identity with them.
Downloads
12
Readme
Ares
HTTP client for calling REST APIs and seamlessly integrating Internet Identity with them.
NOTE: This is a Beta version
How to use
Basic usage
const response = await ares<TestResponse>({
url: `${process.env.NEXT_PUBLIC_API_REST_URL}/test`,
method: "POST",
data: {
message: "Hello, World!",
},
headers: {
"Content-Type": "application/json",
},
});
Direct access to a method
const response = await ares.post<TestResponse>(
`${process.env.NEXT_PUBLIC_API_REST_URL}/test`,
{
message: "Hello, World!",
},
{
headers: {
"Content-Type": "application/json",
},
}
);
Create an instance
const instance = ares.create({
baseURL: `${process.env.NEXT_PUBLIC_API_REST_URL}`,
});
const response = await instance.post<TestResponse>(
"/test",
{
message: "Hello, World!",
},
{
headers: {
"Content-Type": "application/json",
},
}
);