LowDB Powered Blog
LowDB Powered Blog

LowDB Powered Blog

Tags
Website
Blog
Published
February 1, 2018
Author
Clark Weckmann
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.
notion image
Clone on Github
$ git clone https://github.com/clarkhacks/LowDB-Blog.git $ cd LowDB-Blog

Setup

  1. Run npm install
  1. Set a secret in secret.example.json. Make it complicated, like a hard password, (ex: 48zu-QdF5a-dS) with URL friendly characters.
  1. Rename secret.example.json to “secret.json”. (In production use environmental variables)
  1. Set Meta data and Posts via the API or db.json (In production store data in .data/db.json)
  1. 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 titledatebody, 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 userbiolinkphoto, 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