Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hilmanski/Github-content-CRUD-API
CRUD API to manipulate contents in your folder's repository (headless CMS)
https://github.com/hilmanski/Github-content-CRUD-API
headless-cms
Last synced: about 1 month ago
JSON representation
CRUD API to manipulate contents in your folder's repository (headless CMS)
- Host: GitHub
- URL: https://github.com/hilmanski/Github-content-CRUD-API
- Owner: hilmanski
- Created: 2021-07-13T05:47:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-09T00:11:17.000Z (about 2 years ago)
- Last Synced: 2024-08-01T21:40:06.695Z (4 months ago)
- Topics: headless-cms
- Language: JavaScript
- Homepage: api-bitsize-dev.vercel.app
- Size: 23.4 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-made-by-indonesian - Github Repo Content CRUD - `CRUD API to manipulate contents in your folder's repository` *by [Hilman Ramadhan](https://github.com/hilmanski)* (G)
- made-in-indonesia - Github Repo Content CRUD - `CRUD API to manipulate contents in your folder's repository` *by [Hilman Ramadhan](https://github.com/hilmanski)* (G)
README
## Github Repo Content CRUD
CRUD API for a folder's content in a github repo
Think of it as your barebone headless CMSUsing [octokit package](https://octokit.github.io/)
This Nodejs Syntax using [vercel's serverless function](https://vercel.com/docs/serverless-functions/introduction)## Use Case
It's a headless CRUD API for your content in a repositoryUse case:
You want to manage your files through your custom "Admin" UI.But setting up Auth(register/login) on a simple app for just one user (you as an admin) is just too much.
This code will protect sensitive route by using .env params that only we know (like your password). It's located in .env[admin_secret_code=]
## Set Up
Copy paste .env.example to .env
Host it on Vercel (Since it's using vercel's function syntax, you can tweak it based on your serverless provider)
For local server(run: vercel dev)## API List
//All content lists
GET: http://localhost:3000/api/repo//single content
GET: http://localhost:3000/api/repo?file=your-file.md//New content
POST: http://localhost:3000/api/repo
```
params: filename, content, secret_code
```
//Update content
PUT: http://localhost:3000/api/repo
```
params: filename, content, sha(original file), secret_code
```//Delete content
DELETE: http://localhost:3000/api/repo
```
params: filename, sha(original file), secret_code
```## Todo/Plan
- [X] CRUD API
- [X] Password .env protected
- [ ] Validation