Skip to content

A service that exposes a REST API which allows users to create, update, delete and retrieve answers as key-value pairs.

Notifications You must be signed in to change notification settings

eyalgolan/key-value-persistent-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

key-value persistent store

Go Report Card

A service that exposes a REST API that allows users to create, update, delete, and retrieve answers as key-value pairs. The answers are stored in a Postgres DB, so they can handle service restarts.

An answer is defined as:

{
  "key" : "name",
  "value" : "Eyal"
}

An event is defined as:

{
  "event" : "create",
  "data" : 
  {
    "key": "name",
    "value": "Eyal"
  }
}

API

The API exposes the following endpoints:

  • Get answer for a given key (returns the latest answer for the given key): GET /answers/:key
  • Create answer: POST /answers
  • Update answer: PUT /answers
  • Delete answer: DELETE /answers/:key
  • Get history for a given key (returns an array of events in chronological order): GET /answers/:key/history

HOW TO RUN

Pre-requisites

  1. Have docker and docker-compose installed and a docker engine running.
  2. Have ports 5432 and 8080 available.

To first build and run the application, run:

make install

For later runs, use:

make start

To stop the application run:

make stop

About

A service that exposes a REST API which allows users to create, update, delete and retrieve answers as key-value pairs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published