A car rental api service built with Nodejs, Expressjs and MongoDB.
Link to the server : https://damian-car-rental-service.herokuapp.com/
- There are two types of users who interact with the APIs:
- Customer,
- Administrator
- Only administrators can add/update/delete cars.
- A customer can only book a car for themselves.
- Cars can not be booked beyond 2 months from current time of booking.
- Users need not authenticate to see the availability of cars or car details.
- The registration number of a car cannot be updated.
BASE URI : https://damian-car-rental-service.herokuapp.com/api/
Request = email and password.
if authenticated -
Response = “status: 200” and jwt for the customer account.
else -
Response = “status: 400” and message=”invalid credentials”.
Request = json of filter.
Response = “status : 200” and list of cars with their details.
Request = jwt of user and vehicle number of car, start time and end time of booking.
If user is authenticated and car is available -
Response = “status: 200” and message= “booking complete”
else -
Response = “status: 400” and message=”booking failed”
Request = vehicle number of the car.
If a car with given vehicle number exists -
Response = “status : 200” and json data containing details of car.
else -
Response = "status : 404" and message="no such car exists."
Request = email and password.
if authenticated -
Response = “status: 200” and jwt for the customer account.
else -
Response = “status: 400” and message=”invalid credentials”.
Request = jwt of admin and json data of new car to be added.
if authenticated and a car with given vehicle number does not exist -
Response = “status: 200” and message = "Successfully added car to the service".
else -
Response = “status: 400” and message=”couldn't add car”.
Request = jwt of admin and json data of updated details of car.
if authenticated and a car with given vehicle number exists -
Response = “status: 200” and message = "Successfully updated car".
else -
Response = “status: 400” and message=”couldn't update car”.
Request = jwt of admin and vehicle number of car to be deleted.
if authenticated and a car with given vehicle number exists -
Response = “status: 200” and message = "Successfully deleted the car".
else -
Response = “status: 400” and message=”couldn't delete car”.
- Utilities folder contains some frequently used functions.
- Models/Classes folder contains classes for models. These classes provide both instance and static methods for model
(e.g., bookCar() in car.class.js). - Controllers/Queries folder contains queries for each model. This is used to quickly inspect a query and change it if needed.
- Postman test APIs folder contains the exported requests for testing from postman client.