Skip to main content
  1. Projects/

JOS

·111 words·1 min
Jake Roggenbuck
Author
Jake Roggenbuck
I am currently studying Computer Science

JOS #

JSON Object Store - quickly send JSON to a server and retrieve it with a hash

Build
Go
Docker

Usage #

export ADMIN_PASSWORD=<password>

Upload a file #

curl -u "Admin:$ADMIN_PASSWORD" -F "myFile=@path_to_your_file" \
    http://localhost:8080/api/v1/upload-file
{
  "hash": "<hash>",
  "message": "File uploaded and saved successfully!"
}

Get a file #

curl -u "Admin:$ADMIN_PASSWORD" http://localhost:8080/api/v1/get-file?hash=<hash>

Upload JSON #

curl -u "Admin:$ADMIN_PASSWORD" -X POST -H "Content-Type: application/json" \
    -d '{"key": "value"}' http://localhost:8080/api/v1/upload-json
{
  "hash": "<hash>",
  "message": "JSON uploaded and saved successfully!"
}

Get JSON #

curl -u "Admin:$ADMIN_PASSWORD" http://localhost:8080/api/v1/get-json?hash=<hash>

Setup #

Build the container

docker build -t jos-server .

Run the container

docker run -d --name jos_server -p 8080:8080 jos-server

Check that it’s running

docker ps