A Budget Proposal system for Helium Payments.
npm install
systemctl start docker
(Linux)docker-compose build
(re-run whenever Dockerfile or package.json changes)docker-compose up
docker-compose exec api npm run db:migrations:run
Notes
sudo
with some commands.This will start the app along with dashd
. Also run the frontend.
To enable the mailer, process.env.MAILGUN_API_KEY
and process.env.MAILGUN_DOMAIN
must be set:
export MAILGUN_API_KEY=[api-key] && export MAILGUN_DOMAIN=[domain] && docker-compose up
Run the test suite:
npm run test
npm run test */**/createUser.test.js # run tests for a specific file
npm run test */**/user/*.test.js # run tests for a specific directory
npm run test -- --verbose
Tests are run against a separate test database. Make sure you run docker-compose up
first. Migrations are automatically run during tests.
v0 // Alpha version, subject to constant change
GET v0/comments?proposalHash= // Get all comments for a proposal
POST v0/comments // Create a new comment
PUT v0/comments/:id // Update a comment by id
DEL v0/comments/:id // Delete a comment by id
POST v0/comments/:id/vote // Vote on a comment
GET v0/core/proposals // All proposals
GET v0/core/proposals/:hash // Single proposal
GET v0/core/raw-cli/* // Raw data from the cli
POST v0/login // Login with username (or email) and password
POST v0/login/sendPasswordResetEmail // Trigger password reset workflow for provided email
POST v0/users // Create a new user
GET v0/users/:id // Fetch a user by id
PUT v0/users/:id // Updates a user by id
POST v0/users/:id/confirmEmail // Confirms the users email with short-lived token
POST v0/users/:id/resetPassword // Updates the users password with short-lived token
Middleware adds common behaviour to routes handlers.
Auth scopes are used to allow JWTs to perform a subset of actions against the api. The set of scopes can be found in scopes.js.
user:*
allows access the auth token to user create, get and update (created by logging in)user:resetPassword
allows the auth token to reset the users password (created by reset password workflow)user:confirmEmail
allows the auth token to confirm the email address (created by email confirmation workflow)Creates a new migration file in database/migrations:
npm run db:migrations:make [name]
Runs migrations inside the docker container (run docker-compose up first):
docker-compose exec api npm run db:migrations:run
Rollback the latest migration from within the docker container:
docker-compose exec api npm run db:migrations:rollback