Sign inSign up

chwzr/sfhb

By chwzr

•Updated over 5 years ago

Image
0

334

chwzr/sfhb repository overview

⁠sfhb - super fast headless blog

Publish Docker image

This is a super fast REST-API Server for simple blogs written in golang.

⁠Data Format and Storage

sfhb is powered by a realy simple data structure

type Article struct {
	Id      uuid.UUID `json:"id"`
	Title   string    `json:"title"`
	Type    string    `json:"type"`
	Content string    `json:"content"`
	Created time.Time `json:"created"`
}

this translates to simple json

{
  id: "uuid",
  title: "title"
  type: "whatever"
  content: "yay"
  created: "ISO 8601 date string"
}

sfhb will store its data in a single json file: data.json

⁠Rest endpoints

  • GET

/articles Returns all articles in chronological order

/article/{id} Returns a single article by id

  • POST

/article Takes a JSON Object with following keys: title, type, content as Body. id and created fields will be generated by sfhb. Returns the created Object.

  • DELETE

/article/{id} Deletes Articles by ID

⁠Environment Config

There are two .env Variables you can set

PORT (default: 8080) TOKEN (default: none)

The token is used for authentication of POST and DELETE endpoints

⁠Docker

Docker image is available on Docker Hub

docker run -p 8080:8080 -e TOKEN=mysecrettoken chwzr/sfhb

Tag summary

Content type

Image

Digest

Size

2.5 MB

Last updated

over 5 years ago

docker pull chwzr/sfhb:v0.3.3