jangle-cms

1.0.1 • Public • Published

jangle-cms

a headless cms built on mongoose.

API Documentation

"It's not done until the docs are great." - Evan Czaplicki, creator of elm

Jangle breaks up API endpoints into two categories:

  • Public: Does not require an authentication token.

  • Protected: Requires an authentication token for access.

Authentication API (Public)

Check if any users exist, sign up, and sign in.

Route Description Query Params
GET /api/auth/status Determine if any users have been created. (None)
POST /api/auth/sign-up Create first user with an email, password, and role. (None)
POST /api/auth/sign-in Attempt to sign in a user with an email and password. (None)

List API

Find, create, update, and remove items.

Route Description Query Params
GET /api/:list Find items in :list collection. where, skip, limit, populate, select, sort
GET /api/:list/:id Get :list items with :id populate, select
POST /api/:list Create a new item in :list None.
PUT /api/:list/:id Completely replace the :list item with :id with a new item. None.
PATCH /api/:list/:id Update some fields for the :list item with :id None.
DELETE /api/:list/:id Remove the :list item with :id permanent

Schema API

Get available lists and their fields (So you can roll your own Admin UI).

Route Description Query Params
GET /api/jangle/schemas Gets all Jangle lists and their fields. None
GET /api/jangle/schemas/:list Finds the Jangle list with name :list and its fields. None

History API

Look at item history, preview and commit a restore to a previous version.

Route Description Query Params
GET /api/jangle/history/:id Returns complete history for an item. None
GET /api/jangle/history/:id/restore Preview the result of a version restore. list, version
POST /api/jangle/history/:id/restore Perform a version restore. list, version

Publishing API

Make content visible to anonymous users (read-only).

Route Description Query Params
POST /api/:list/publish/:id Publishes the latest version of an item. None
DELETE /api/:list/unpublish/:id Unpublishes a published item. None

Examples

GET /api/jangle/users
> { error: true, message: "Please provide a valid token.", data: [] }

GET /api/jangle/users?token=<...>
> { error: false, message: "Found 3 users.", data: [ ... ]}

POST /api/jangle/users?token=<your-token>
body: { "email": "ryan.nhg@gmail.com", "password": "...", "role: "admin" }
> { error: false, message: 'User created.', data: { ... } }

Readme

Keywords

Package Sidebar

Install

npm i jangle-cms

Weekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators

  • ryannhg