@mawoka/pbe
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

PersonalBlogEngine

This is the client-library for PBE, a free and easy-to-use headless CMS!

Getting Started

Requirements

  • A running instance of PBE (See here)
  • Your own frontend for your blog

Setup

  1. Install the library: npm i @mawoka/pbe
  2. Use it
import {PBE, isError} from "@mawoka/pbe"

const pbe = new PBE("https://your_pbe_install.test") // Note: There isn't a "/" at the end of the url
// Get a single post via a slug
const post = pbe.get_post("your_slug", false) // You can either get the HTML (false) or the markdown (true)
// Now, check if the post isn't an error:
if (isError(post)) {
    // Get the status_code the api returned:
    const code = post.http_status_code
    if (code === 404) {
        alert("Post not found")
    } else {
        alert("Unknown error!")
    }
}
  1. Look at the API docs

Readme

Keywords

none

Package Sidebar

Install

npm i @mawoka/pbe

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

280 kB

Total Files

26

Last publish

Collaborators

  • mawoka