Postleaf / postleaf

Simple, beautiful publishing with Node.js.
https://www.postleaf.org/
MIT License
504 stars 204 forks source link

Postleaf API #52

Closed ericbets closed 7 years ago

ericbets commented 7 years ago

What about publishing a simple api for postleaf for major postleaf functionality? Perhaps it would fit in as part of #27.

eg.

const postleaf = require("postleaf-api");
const api = postleaf.login("user","pass");
const post = api.post({ title:"Title", content:"This is a post", publish:true});
claviska commented 7 years ago

The app itself is [mostly] RESTful. You can already do every operation that happens internally with the API — it's just not documented yet. (Docs are a lot of work for one person, and things are still changing here and there in alpha.)

For now, take a look at the API router for the endpoints: https://github.com/Postleaf/postleaf/blob/master/source/routers/api_router.js

And the API controllers for parameters: https://github.com/Postleaf/postleaf/tree/master/source/controllers/api

Each controller method has comments that show params and responses if you need to start using it right away. 🙂