Git Product home page Git Product logo

bookaduc-api's Introduction

BookADuc API

Select your favorite Ducati bike and book an appointment to take it for a test ride! This is Microverse's final capstone project!

Table of Contents

About

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.

Live version

A live version of the API is hosted on Heroku.

The user has to create an account to get access to the API. The following endpoints are implemented:

Signup

  • POST: https://bookaduc-api.heroku.com/api/v1/users
  • Parameters: {name: string, email: string, password: string}

Login

  • POST: https://bookaduc-api.heroku.com/auth/login
  • Parameters: { email: string, password: string }

Get a list of bikes

  • GET: https://bookaduc-api.heroku.com/api/v1/bikes
  • Parameters: { Authorization: 'Bearer ${token}'

Get a specific bike

  • GET: https://bookaduc-api.heroku.com/api/v1/bikes/${id}
  • Parameters: { Authorization: 'Bearer ${token}'

Create a new booking

  • GET: https://bookaduc-api.heroku.com/api/v1/bookings/new
  • Parameters: { city: string, date: date, user_id: integer, }
  • Headers: { Authorization: 'Bearer ${token}'

Get user bookings

  • GET: https://bookaduc-api.heroku.com/api/v1/users/${id}
  • Parameters: { Authorization: 'Bearer ${token}'

Up

Example Response

Example JSON responce when getting list of bikes.

Example JSON response for current user

Up

Technologies Used

  • Ruby on Rails 6
  • PostgreSQL

Up

Setup and Run in Your Computer

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

Up

๐Ÿ‘ค Author

Nick Haralampopoulos

Show your support

Give a โญ๏ธ if you enjoyed this project!

Acknowledgements

Up

๐Ÿ“ License

This project is MIT licensed.

bookaduc-api's People

Contributors

macnick avatar

Stargazers

Yoko Saka avatar Kubilay Caglayan avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.