Categorygithub.com/LucDeCaf/go-simple-blog
modulepackage
0.0.0-20240923085954-e1ba20612dc7
Repository: https://github.com/lucdecaf/go-simple-blog.git
Documentation: pkg.go.dev

# README

Barista (Backend)

A backend for the blogging app Barista.

Usage

  1. Install project-external dependencies
  • Go (programming language)
  • Goose (database migration tool)
  • SQLite (database driver)
  1. Clone the project locally and navigate to project folder
git clone https://github.com/LucDeCaf/barista-backend
cd barista-backend
  1. Install project dependencies
go mod download
  1. Create an empty database using Goose
cd migrations
goose sqlite3 ../db.db up
  1. Run the project locally
cd ..
go run main.go

The app should now be running locally on port 8080.

<< curl localhost:8080/v1/blogs
>> []

Specifications

  • Go net/http package
  • Goose SQL migration management tool
  • SQLite database

How to (roughly) use the API

This API is not expected to be exposed directly to the internet but is instead meant to run as an internal process on a server which is also running a separate frontend that will be exposed to the internet.

EndpointDescriptionResponseRequired headers
GET /v1/blogsGet all blogs in JSON formatBlog array (JSON)
POST /v1/blogsCreate a new blogBlog (JSON)Authorization
GET /v1/blogs/{id}Get blog with the specified IDBlog (JSON)
DELETE /v1/blogs/{id}Delete blog with the specified IDBlog (JSON)Authorization
POST /v1/usersPerform an action involving usersVariesServer-Action, possibly Authorization
POST /loginLogin the user as specified in request bodyAuthorization JWT
POST /registerRegister a new user as specified in request bodyUser (JSON)

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author