Select your favorite Ducati bike and book an appointment to take it for a test ride! This is Microverse's final capstone project!
- About this project
- Live Version
- Example Response
- Technologies Used
- Setup and Run
- Author
- Show your support
- Acknowledgments
This is the backend of the project. It is built with Ruby on Rails. You can use this app to access it or build your own front-end.
The app uses 3 tables to save Users, Bikes, and Bookings. Authentication is implemented using JSON Web Token. Implemented versioning so new version can be created without breaking the old ones. Also implemented data serialization using the Active Model Serializer gem. The serializer allows returning all the related data in an organized format. Consequently, front-end apps do not have to make extra API requests to get the relevant data.
A live version of the API is hosted on Heroku.
- BookADuc @ Heroku
The user has to create an account to get access to the API. The following endpoints are implemented:
- POST:
https://bookaduc-api.heroku.com/api/v1/users
- Parameters:
{name: string, email: string, password: string}
- POST:
https://bookaduc-api.heroku.com/auth/login
- Parameters:
{ email: string, password: string }
- GET:
https://bookaduc-api.heroku.com/api/v1/bikes
- Parameters:
{ Authorization: 'Bearer ${token}'
- GET:
https://bookaduc-api.heroku.com/api/v1/bikes/${id}
- Parameters:
{ Authorization: 'Bearer ${token}'
- GET:
https://bookaduc-api.heroku.com/api/v1/bookings/new
- Parameters:
{ city: string, date: date, user_id: integer, }
- Headers:
{ Authorization: 'Bearer ${token}'
- GET:
https://bookaduc-api.heroku.com/api/v1/users/${id}
- Parameters:
{ Authorization: 'Bearer ${token}'
Example JSON responce when getting list of bikes.
Example JSON response for current user
- Ruby on Rails 6
- PostgreSQL
Use your terminal and run the commands after each instruction.
Command | Description |
---|---|
git clone https://github.com/macnick/bookaduc-api.git |
Clone the repository to you computer |
cd bookaduc-api |
Navigate to the newly created folder |
bundle install |
Install gem dependencies |
rails db:create followed by rails db:migrate |
Setup the database |
rails server |
Starts the development server |
Press Ctrl + c to kill http-server process |
|
rails db:seed |
Fill the db with the required Bike data |
http://localhost:3000 |
Visit this link in your browser to use it |
- Github: @macnick
- Twitter: @mac_experts
- Linkedin: Nick Haralampopoulos
- AngelList: Nick Haralampopoulos
Give a โญ๏ธ if you enjoyed this project!
- Microverse software development school
- Article used for learning API authorization
This project is MIT licensed.