melitus / car-booking-api

This car booking API will allow users to book for cars and view also previously booked cars filtered by users. User needs to be an authenticated user to book a car, get all cars or get previous booked cars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Car Booking API 🛡️

Tools

  • NodeJS
  • Express
  • Sequelize
  • PostgreSQL

Getting Started

The easiest way to get started is to clone the repository:

clone the repository

git clone https://github.com/melitus/car-booking-api.git

Change directory

cd car-booking-api

Install NPM dependencies

yarn install

start the server

yarn run dev

Note: It is recommended to install nodemon for livereloading - It watches for any changes in your node.js app and automatically restarts the server

Deployment

Deployment to Heroku

  • Download and install Heroku CLI

  • In a terminal, run heroku login and enter your Heroku credentials

  • From your app directory run heroku create

  • Use the command heroku config:set KEY=val to set the different environment variables (KEY=val) for your application (i.e. heroku config:set BASE_URL=[heroku App Name].herokuapp.com etc.)

  • Do git add .

  • Do git commit -m" reason for commit"

  • Lastly, do git push heroku master.

Please note that you may also use the Herko Dashboard to set or modify the configurations for your application.

View live demo and test with any api

I used postman to test the api. To use postman, go to the project doc folder and import the docs file into your postman client to ease the testing

User Endpoint

  • Login - https://car-booking-backend.herokuapp.com/v1/api/user/login
  • Register - https://car-booking-backend.herokuapp.com/v1/api/user/register

Car Endpoints

  • Get all cars - https://car-booking-backend.herokuapp.com/v1/api/booking?pagesize=10&pagenumber=1

  • Book a car - https://car-booking-backend.herokuapp.com/v1/api/booking

  • Get previous booking filtered by user - https://car-booking-backend.herokuapp.com/v1/api/booking/24d551b9-6845-443a-ba9e-de18dd0b4fec/previous?pagesize=10&pagenumber=1

About

This car booking API will allow users to book for cars and view also previously booked cars filtered by users. User needs to be an authenticated user to book a car, get all cars or get previous booked cars

License:Apache License 2.0


Languages

Language:JavaScript 97.4%Language:Dockerfile 2.6%