Version: 3.6.x
Get REST request (response structured)
import Joi from "joi";
import { RestRequest, IResponse } from "@mihanizm56/fetch-api";
export const getWhateverRequest = (): Promise<IResponse> =>
new RestRequest().getRequest({
endpoint: "http://localhost:3000",
responseSchema: Joi.object({
username: Joi.string().required(),
password: Joi.string().required(),
info: Joi.object({
count: Joi.number().required(),
killers: Joi.array().items(
Joi.object({
username: Joi.string().required(),
count: Joi.number().required(),
})
),
}),
}),
});