Skip to content

compscidr/goblog

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
www
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

goblog

Go codecov License

Simple blogging platform built with golang. Currently running on my website: https://www.jasonernst.com

It is split into two parts:

  • A JSON REST API located at /api/v1/
  • An HTML API located at /

The HTML API is optional - any frontend could be used instead. I toyed with a single page Javascript app for a bit, but I like to have all of the content generated on the server side so that SEO works better.

Users can log into the blog using Github authentication code which is then translated by the blog API into an authorization token, which is then stored in a session cookie.

Creating, modifying and deleting posts and administering comments may only be done with the admin user. Presently the user is hardcoded by github email, but I'll likely create an initial install onboarding which makes the first logged in user the admin.

Other logged in users are able to post, update and delete comments (todo)

Every function in the API should be covered by units and integration tests.

What works:

  • List, Create, Update, Delete
  • Local sqlite3 db in a file
  • Markdown rendering, code highlighting for content
  • Posts, Tags, Error Pages, File Uploads (images, pdfs, etc)
  • Github action which builds and deploys a tagged dockerhub release when a versioned release is cut
  • Version string in template header from git describe
  • Meta, Title, etc which changes with posts for SEO
  • Post date editing so old posts can be imported
  • Wordpress import, Medium import tool (kind of manually)

Todo:

  • draft posts
  • default hero images or something so posts don't look so bare
  • cron job to backup posts
  • user comments
  • install onboarding
  • mysql, postgres, other dbs

Other tools used:

Building and running:

go build
goblog

Testing

go test goblog/...

Coverage:

More details here: https://blog.golang.org/cover

go test goblog/... -coverprofile=coverage.out
go tool cover -func=coverage.out
go tool cover -html=coverage.out

About

Simple blogging platform built with golang. Built on top of gin and gorm. Auth with github. REST / CRUB API backend and templated frontend

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published