LowDB Blog is a LowDB (ya don’t say?) and jQuery powered blog with a full private and public API. This repository is updated frequently.
or
Clone on Github
$ git clone https://github.com/clarkhacks/LowDB-Blog.git
$ cd LowDB-Blog
Setup
- Run
npm install
- Set a secret in
secret.example.json
. Make it complicated, like a hard password, (ex: 48zu-QdF5a-dS) with URL friendly characters. - Rename
secret.example.json
to “secret.json”. (In production use environmental variables) - Set Meta data and Posts via the API or
db.json
(In production store data in.data/db.json
) - Run
node server.js
API
The API is relatively simple to understand and use. It is based around post requests and your .env
secret you set earlier. Examples are shown in jQuery.
New Post
End Point /posts/new
Parameters title
,date
,body
, and token
.
Example $.post("/posts/new", { title: "Title", date: "Month Day, body: "Lorem ipsum...", token: "TOKENHERE"});
All queries are required.
Meta Data
End Point /meta/:ID
IDs user
,bio
,link
,photo
, photo
, and title
.
Parameters value
, text
, and token
.
Example $.post("/meta/bio", { value: "Lorem ipsum...", token: "TOKENHERE"});
Example 2 $.post("/meta/link", { text: "Google", value: "google.com", token: "TOKENHERE"});
All queries are required expres text. Text is used only for the link
ID.
Public API
The public API is a read only version of the LowDB json file.
End Point /api/v1
Top comments (0)