Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krmax44/cocy
Transform your content into an API.
https://github.com/krmax44/cocy
api content jamstack markdown
Last synced: about 2 months ago
JSON representation
Transform your content into an API.
- Host: GitHub
- URL: https://github.com/krmax44/cocy
- Owner: krmax44
- Created: 2019-09-05T20:12:05.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-03-24T15:04:35.000Z (almost 3 years ago)
- Last Synced: 2024-10-16T09:24:00.725Z (3 months ago)
- Topics: api, content, jamstack, markdown
- Language: TypeScript
- Homepage: https://cocy.js.org
- Size: 2.09 MB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cocy
[![CI status](https://img.shields.io/github/workflow/status/krmax44/cocy/build/main)](https://github.com/krmax44/cocy/actions)
[![Code coverage](https://img.shields.io/codecov/c/github/krmax44/cocy?token=RcYyQnebV1)](https://codecov.io/gh/krmax44/cocy)
[![npm version](https://img.shields.io/npm/v/cocy)](https://www.npmjs.com/package/cocy)Cocy takes your static-file content and turns it into a consumable API for your [JAMstack](https://jamstack.org) site. The headless content management library, no matter what framework you're using.
## Packages
Docs are provided per package.
| Name | Description | Package |
| ----------------------------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [cocy](./packages/cocy/README.md) | main docs | [![npm version](https://img.shields.io/npm/v/cocy)](https://www.npmjs.com/package/cocy) |
| [transform-md](./packages/transform-md/README.md) | Transform Markdown to HTML | [![npm version](https://img.shields.io/npm/v/@cocy/transform-md)](https://www.npmjs.com/package/@cocy/transform-md) |
| [transform-yaml](./packages/transform-yaml/README.md) | Parse YAML files | [![npm version](https://img.shields.io/npm/v/@cocy/transform-yaml)](https://www.npmjs.com/package/@cocy/transform-yaml) |
| [render-json](./packages/render-json/README.md) | Output static JSON files | [![npm version](https://img.shields.io/npm/v/@cocy/render-json)](https://www.npmjs.com/package/@cocy/render-json) |## Roadmap to v1
See the [Roadmap](https://github.com/krmax44/cocy/projects/1).
## Example
```
📦 current working directory
┣ 📂 posts
┃ ┣ 📄 Hello-World.md
┃ ┣ 📄 Second-Post.md
``````ts
import Cocy from 'cocy';
import md from '@cocy/transform-md';const cocy = new Cocy().use(md); // setup Cocy with Markdown transformer
await cocy.process(); // search for filesfor (const file of cocy.files.values()) {
console.log(file.slug);
}/*
output:
hello-world
second-post
*/const { data } = cocy.files.getByPath('posts', 'Hello-World.md');
console.log(data.html);/*
output:
Hey!
*/
```