In this project, a digital account API was created with Elixir + Phoenix. This project was presented on the Next Level Week #4 from RocketSeat, as was improoved for study purpose.
Among the improovements, you will find:
- Changing the Authentication method from
Basic Auth
to aJWT
based (Using the libGuardian
) - Implementing a new Route to return the data of the logged in user
- Implementing the API documentation with Swagger (Using the lib
Phoenix_swagger
) - Implementing more tests to reach 100% test coverage with
Excoveralls
- Implementing a Factory to improove test readability (Using the lib
ExMachina
) - Implementing a data randomization lib to improove tests (Using the lib
Faker
) - Improoving the error handler
- Install dependencies with:
$ mix deps.get
- Create a PostgreSQL database on the default port
5432
(You can change the port on theconfig/config.exs
file if needed)- You can use
Docker
(which i recommend) to create the database. Just run the following command:$ docker run --name rocketpay -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres
- You can use
- Setup and migrate your database with:
mix ecto.setup
- Start Phoenix endpoint with:
$ mix phx.server #or inside IEx with $ iex -S mix phx.server
Now you can visit localhost:4000
from your browser.
To check the Swagger Documentation, you can visit the route /api/swagger
.
- Official website: https://www.phoenixframework.org/
- Guides: https://hexdocs.pm/phoenix/overview.html
- Docs: https://hexdocs.pm/phoenix
- Forum: https://elixirforum.com/c/phoenix-forum
- Source: https://github.com/phoenixframework/phoenix