Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eyalgolan/key-value-persistent-store
A service that exposes a REST API which allows users to create, update, delete and retrieve answers as key-value pairs.
https://github.com/eyalgolan/key-value-persistent-store
docker docker-compose gin gin-gonic go golang gorm gorm-orm key-value postgres postgresql rest rest-api
Last synced: 27 days ago
JSON representation
A service that exposes a REST API which allows users to create, update, delete and retrieve answers as key-value pairs.
- Host: GitHub
- URL: https://github.com/eyalgolan/key-value-persistent-store
- Owner: eyalgolan
- Created: 2022-09-13T08:20:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-10T17:55:47.000Z (over 1 year ago)
- Last Synced: 2024-11-15T22:52:01.389Z (about 1 month ago)
- Topics: docker, docker-compose, gin, gin-gonic, go, golang, gorm, gorm-orm, key-value, postgres, postgresql, rest, rest-api
- Language: Go
- Homepage:
- Size: 87.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# key-value persistent store
[![Go Report Card](https://goreportcard.com/badge/github.com/eyalgolan/key-value-persistent-store)](https://goreportcard.com/report/github.com/eyalgolan/key-value-persistent-store)
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:
```json
{
"key" : "name",
"value" : "Eyal"
}
```An event is defined as:
```json
{
"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:
```bash
make install
```
For later runs, use:
```bash
make start
```
To stop the application run:
```bash
make stop
```