To view the OpenAPI documentation:
- Go to https://editor.swagger.io/
- Copy'n'paste the content of
docs/openapi.yaml
into the editor - Enjoy!
To build this as a docker image run:
docker build -t blockchain-voting-backend .
To run it on docker:
docker run -it --rm --init -p 9999:9999 blockchain-voting-backend
It'll listen on port TCP 9999
for http requests. CTRL-C
to stop it.
Make sure to have installed:
- NodeJS (current LTS recommendeD)
- TypeScript
npm install -g typescript
- The ability to build
node-gyp
modules
To build:
npm install
tsc
To run: node ./build/server.js
The backend can be configured by some environment variables:
Variable | Description | Default |
---|---|---|
DB_HOST |
Postgres database host | localhost |
DB_USER |
Postgres database user | votingadmin |
DB_PASSWORD |
Postgres database password | supersecret |
CONTRACT_ADDR |
Ethereum smart contract address | 0x50ba2e417d573fcd67fab8ee5d6d764b105cd5f7 |
PORT |
HTTP API port to listen on | 9999 |
RPC_URL |
URL to the ethereum client RPC | http://localhost:8545 |