Track your workouts!
Created with Elixir, Phoenix and Absinthe.
Made with ❤️
- Create and get users
- Create training and exercise tracking
- Elixir
- Erlang
- Phoenix
- Postgres database
SSH URLs provide access to a Git repository via SSH, a secure protocol. If you have an SSH key registered in your GitHub account, clone the project using this command:
git clone [email protected]:LuizFerK/Wabanex.git
In case you don't have an SSH key on your GitHub account, you can clone the project using the HTTPS URL, run this command:
git clone https://github.com/LuizFerK/Wabanex.git
Both of these commands will generate a folder called Wabanex, with all the project
- Run
mix deps.get
to install the dependencies - Create a postgres database named
wabanex
- On the
config/dev.exs
andconfig/test.exs
files, change your postgres user and password - Run
mix ecto.migrate
to run the migrations to your database - Run
mix phx.server
to start the server on port 4000
http://localhost:4000/api/graphql
http://localhost:4000/api/graphiql
(Absinthe GraphiQL interface)
-
🟢 Create
-
Request
mutation { createUser(input: { name: "John Doe", email: "[email protected]", password: "123456" }) { id name } }
-
Response
{ "data": { "createUser": { "id": "4b2c733d-541d-4cdf-bd27-40ea3f03aa48", "name": "John Doe" } } }
-
-
🟣 Get
-
Request:
query { getUser(id: "4b2c733d-541d-4cdf-bd27-40ea3f03aa48") { id name email trainings { startDate endDate exercises { name repetitions } } } }
-
Response
{ "data": { "getUser": { "email": "[email protected]", "id": "4b2c733d-541d-4cdf-bd27-40ea3f03aa48", "name": "John Doe", "trainings": [ { "endDate": "2021-11-21", "exercises": [ { "name": "Triceps banco", "repetitions": "4x12" }, { "name": "Triceps corda", "repetitions": "5x12" } ], "startDate": "2021-10-21" } ] } } }
-
-
🟢 Create
-
Request
mutation { createTraining(input: { userId: "4b2c733d-541d-4cdf-bd27-40ea3f03aa48", startDate: "2021-10-21", endDate: "2021-11-21", exercises: [ { name: "Triceps banco", youtubeVideoUrl: "youtube.com", protocolDescription: "drop-set", repetitions: "4x12" }, { name: "Triceps corda", youtubeVideoUrl: "youtube.com", protocolDescription: "drop-set", repetitions: "5x12" } ] }) { id, exercises { id, name } } }
-
Response
{ "data": { "createTraining": { "exercises": [ { "id": "348bd17b-92cd-487d-b043-65594680c19c", "name": "Triceps banco" }, { "id": "7b23b24a-95ad-4cb6-a8c2-f30fda4213cb", "name": "Triceps corda" } ], "id": "f5fadab4-49d8-4682-a514-f447eab897f1" } } }
-
- Ecto
- Absinthe (GraphQL)
- Crudry (Error handling)
Find a bug or error on the project? Please, feel free to send me the issue on the Wabanex issues area, with a title and a description of your found!
If you know the origin of the error and know how to resolve it, please, send me a pull request, I will love to review it!
Released in 2021.
This project is under the MIT license.
< keep coding /> 🚀 ❤️