This is the API server.
Find a file
array-in-a-matrix e366c3b6e6 add 1 endpoint
2024-07-24 19:16:32 -04:00
.vscode vscodium extension recommendatiosn 2024-06-28 11:46:13 -04:00
src fixed bug 2024-07-24 18:30:22 -04:00
tests add 1 endpoint 2024-07-24 19:16:32 -04:00
.gitignore compile server exe in docker and export to /bin/ 2024-07-19 17:30:33 -04:00
bin.dockerfile make release exe 2024-07-24 14:44:07 -04:00
dockerfile updated default port 2024-07-24 14:43:59 -04:00
LICENSE Initial commit 2024-06-11 12:51:31 -04:00
nim.cfg more debug 2024-07-19 20:37:30 -04:00
README.md updated 2024-07-24 14:41:33 -04:00
server.nimble add checksum lib for sha3 2024-06-28 11:07:06 -04:00

Glimpse API server

This is the Glimpse API server.

Compilation and deployment

Host

Install needed libraries:

nimble install jester norm checksums

Build glimpse executable:

nimble build

Compile and run:

nimble run

Docker

To compile the binary only, run the following (executable will be found in /bin/):

docker buildx build -t glimpse-server:latest --output=bin --target=runner -f

To deploy an instance of glimpse within docker, run:

docker buildx build -t glimpse-server:latest .
docker run -it --rm -p 8080:8080 glimpse-server:latest

Use the following to run a temporary PostgreSQL database, (DO NOT USE IN PRODUCTION):

docker run -it --rm -e POSTGRES_USER=user -e POSTGRES_PASSWORD=postgresql -p 5432:5432 postgres

Usage

Configuration

Glimpse will create the default configuration file, config.ini, in the root of the directory if it does not exist. Configuration relating to web framework, Jester, is under the Server section. Database configuration is under the Database section. Other configuration variables are under General.

API Endpoints

Each endpoint has comments describing what type of request it is and what parameters it takes. Example requests using cURL:

curl -X <POST|GET|PUT|DELETE> <Endpoint URI> -H '<Request Body Contents>'
curl -X POST http://localhost:5000/api/v1/newUser -H 'Username=Array' -H 'Password=i8Vl8XZaVRiZFsZ'
curl -X POST -H "Authorization: <access_token>" -F "file=@image.png" http://localhost:5000/api/v1/newFile