Skip to content

icebaker/badger-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Badger DB

A minimalist HTTP API for Badger DB.

Running

Copy the .env.example file to .env and provide the required data.

go build
./badger-db

Usage

Verb Path Description
GET / It provides information about the API and the Database.
GET /items/:key It returns the value for the given :key. Status 200 if it exists, 404 if not.
HEAD /items/:key Checks if the :key exists without returning its value. Status 204 if it exists, 404 if not.
PUT /items/:key It sets the value for the given :key. The value for the key should be sent in the request body as Plain Text. Status 201 if created, status 204 if updated.
DELETE /items/:key It deletes the value for the given :key. Status 204 if deleted, status 404 if it already doesn't exists.

Docker

version: '3.7'

services:
  badger-db:
    image: icebaker/badger-db:0.0.1
    environment:
      BADGER_DB_DATA_PATH: /badger-db/data
      BADGER_DB_CONTEXT: my-service-name
      BADGER_DB_HOST: 0.0.0.0
      BADGER_DB_PORT: 9701
    volumes:
      - ./my-project/data/badger-db:/badger-db/data
    ports:
      - 9701:9701

Development

go run main.go
go fmt