A small bank API system made for a challenge
This project was written in Elixir and using Cowboy for handling the HTTP requests and Ecto for managing the database.
The features are: sign_up, withdrawal, transfer money and see all transactions.
First of all, need to export your environment variables accordingly to your system setup.
$ export DATABASE_URL='ecto://postgres:postgres@localhost/challenge_repo'
$ export PORT='8080'
Install all code dependencies:
$ mix deps.get
Create the database and run all migrations:
$ mix ecto:setup
Simply run the command below:
$ mix run --no-halt
To stop it, press twice Ctrl + C
.
You can now send your requests to http://localhost:8080 or use the port configured in your environment variables.
To run the tests suite, pass your environment variables and run this command:
Make sure to add _test
to your database name so it will not affect your development database.
$ MIX_ENV=test PORT=8080 DATABASE_URL='ecto://postgres:postgres@localhost/challenge_repo_test' mix tests
To run Credo and make sure the code is consistent, run this command:
$ mix credo --strict
First, make sure you have Heroku properly configured in your machine, then add the Heroku repository:
$ heroku git:remote -a bank-api-merayo
After committing your changes and pushing it to master, run this command:
$ git push heroku master
If you added a migration, run the migration in Heroku:
$ heroku run "mix ecto.migrate"
This project is released under the MIT License.
Made by Emanuel Merayo Goldenberg