DEV Community

Clark Weckmann
Clark Weckmann

Posted on • Originally published at weckmann.me on

LowDB Blog

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. Remix

or

Clone on Github

$ git clone https://github.com/clarkhacks/LowDB-Blog.git
$ cd LowDB-Blog

Enter fullscreen mode Exit fullscreen mode

Setup

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


Reply via email

Top comments (0)