0.1.8 • Published 3 years ago
@codesdowork/strapi_client v0.1.8
Strapi Client
A simple strapi client for your web application.
1. Installation
npm i @codesdowork/strapi_client2. Usage
Import the client and use your custom types the following way:
import StrapiClient from "@codesdowork/strapi_client";
type StrapiTypes = {
user: {
get: User;
send: SendUserForm;
};
restaurants: {
get: Restaurant;
send: SendRestaurantForm;
};
todos: Todo;
}
const strapi = new StrapiClient<StrapiTypes>("http://localhost:1337")You can add types for any collection and additionally for user and strapiFile.
You can either add types for responses (get) and requests (send) or combine them directly
as made for todos in the example above.
You can generate the types using the strapi_tools cli.