This is the backend of an Health Tracker app. It consists of 3 tables, users, units, and measurements. The endpoints in this project includes:
- POST /users Arguments:
{
name: <username>
password: <your_password>
}
creates a user and responds with:
{
user: {}
token: user_token
}
- POST/login Arguments:
{
name: <username>
password: <your_password>
}
Logs in the user and responds with:
{
user: {}
token: user_token
}
- GET /units Arguments:
headers: {
Authorization: 'Bearer <token>'
}
Returns a list of all the availiable units to measure
-GET /units/:id Arguments:
headers: {
Authorization: 'Bearer <token>'
}
Returns the unit with :id and a list of its measurements
- GET /measurements Arguments:
headers: {
Authorization: 'Bearer <token>'
}
returns an object with the name of the unit as keys and the list of measurements as values
- POST /units/:unit_id/measurements Arguments:
headers: {
Authorization: 'Bearer <token>'
}
body: {
value: <float>
}
Creates a measurement for the corresponding unit
- PUT /units/:unit_id/measurements/:id Arguments:
headers: {
Authorization: 'Bearer <token>'
}
body: {
value: <float>
}
Updates the value of the given measurement
-DELETE /units/:unit_id/measurements/:id Arguments:
headers: {
Authorization: 'Bearer <token>'
}
Deletes the given measurement
Contents |
---|
| Live Demo | | Screenshot | | Built With | | Getting Started | | Contributing | | Authors | | License |
- Ruby on Rails
The project wroks with the postgresql database To test the endpoints locally you can use tunneling with ngrok or a similar tool
- Clone the repo
https://github.com/udberg/tracking-api.git
- cd
into
tracking-api - bundle install
- rails db:create
- rails db:migrate
- rails db:seed to populate the database
- bundle exec figaro install In the config/application.yml file that will be created add:
- SECRET: <your_secret>
- bundle exec rspec
- Fork the project
- Create your feature branch
git checkout -b awesome-feature
- Commit your changes
git commit -m 'Awesome feature'
- Push it
git push -u origin awesome-feature
- Open a pull request using this branch
Contributions, issues and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!