0.1.1 • Published 9 months ago

strapi-reader v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Strapi Reader

Type-safe Reader for Strapi API.

Installation

npm install strapi-reader

Usage

import { Many, Reader } from "strapi-reader";

type Article = {
  title: string;
  slug: string;
  body: string;
  tags: Many<Tag>;
};

type Tag = {
  name: string;
  color: string;
  featured: boolean;
};

const reader = new Reader<{
  articles: Article;
  tags: Tag;
}>("http://localhost:1337/api/");

const res = await reader.read("articles", {})
console.log(res.data[0].attributes.title);

License

MIT License

0.1.1

9 months ago

0.1.0

9 months ago