Blog Posts API

An API written in Go that fetches data from and allows sorting options in either descending or ascending order

Tech Stacks

Server: Go 1.18

Run Locally

Go to the project directory

  cd BlogPostAPI

Install dependencies

  go get -u
  go get -u
  go get -u

Start the server

  go run main.go

Make requests using the following base URL as instructed by the API reference


Running Tests

To run tests, run the following command

  go test

API Reference

Ping API

  GET /api/ping
Parameter Type Description
N/A N/A Test to ensure API is up and running

Get posts

  GET /api/posts/${id}
Parameter Type Description
tags string Required. Comma-separated tag list
sortBy string Optional. “id”, “reads”, “likes”, “popularity”
tags string Optional. “asc”, “desc”



View Github