To use this project, first clone the repo on your device using the command below:
git init
git clone /~https://github.com/bilalislam/kvdb-api
$ cd kvdb
$ go build main.go -o kvdb-api
$ ./kvdb-api --help
You can print help following below;
-async
file sync for durability
-interval int
default every second (1s) (default 1)
-maxRecordSize int
max size of a database record (default 65536)
-path string
storage path (default "/tmp")
-port int
http server listening port (default 8080)
$ ./kvdb-api
Runs the app in the development mode.
Open http://localhost:8080 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
$ curl -X POST -H "Content-Type: application/json" -d '{"foo":"bar"}' http://localhost:8080/foo
$ curl -X GET http://localhost:8080/foo
$ go test
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. To learn more about all the features of Compose, see the list of features
A docker-compose.yml looks like:
version: '3'
services:
api:
build:
context: .
dockerfile: tools/Dockerfile
ports:
- "8080:8080"
$ docker-compose up
Open http://localhost:8080 to view it in the browser.