Skip to content

The Car Rental API is a backend service designed for managing car rentals. Built with NestJS and TypeScript, it provides endpoints for user management, car inventory, and authentication.

Notifications You must be signed in to change notification settings

ssssvio/carRentalApi

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

Nest framework TypeScript starter repository.

Car Rental API

Welcome to the Car Rental API project, an application developed for managing a car rental system. This document provides essential information for setting up and using the application.

Prerequisites

To run this application, you need to have the following software installed on your machine:

  • Node.js (v18 or higher)
  • Docker (v20.10 or higher)
  • Docker Compose (v1.27 or higher)

Cloning the Project To start, clone the repository to your local environment:

  git pull git@github.com:ssssvio/carRentalApi.git
  cd carRentalApi

Setting Up the Environment

  1. .env File: Copy the .env.example file to .env and configure the required environment variables.

    cp .env.example .env
  2. docker-compose.yml Configuration: Check and configure the docker-compose.yml file as needed, including passwords and other sensitive information.

Running the Application

To start the application with Docker, run the following command:

docker-compose up --build -d

After the execution is complete, the API will be available within 5-7 minutes at http://localhost:3000/api. You can check if everything is working correctly by accessing this URL.

API Routes

Users - Endpoints

GET /users - Retrieves a list of all users.

  • Response:
    • Status: 200
    • Body: Array of UserDTO objects

GET /users/:id - Retrieves information of a specific user by ID.

  • URL Parameters:
    • id (number): User ID
  • Response:
    • Status: 200
    • Body: UserDTO object

POST /users - Creates a new user.

  • Body: UserDTO object
  • Response:
    • Status: 201
    • Body: UserDTO object

PUT /users/:id - Updates an existing user's information.

  • URL Parameters:
    • id (number): User ID
  • Body: UserDTO object
  • Response:
    • Status: 204

DELETE /users/:id - Deletes a user by ID.

  • URL Parameters:
    • id (number): User ID
  • Response:
    • Status: 204

Auth - Endpoint

POST /auth/login - Logs in a user.

  • Body: LoginDto object
  • Response:
    • Status: 201
    • Body: JWT Token

Cars - Endpoints

GET /cars - Retrieves a list of all available cars.

  • Response:
    • Status: 200
    • Body: Array of CarDTO objects

GET /cars/:id - Retrieves information of a specific car by ID.

  • URL Parameters:
    • id (number): Car ID
  • Response:
    • Status: 200
    • Body: CarDTO object

POST /cars - Creates a new car.

  • Body: CarDTO object
  • Response:
    • Status: 201
    • Body: CarDTO object

PUT /cars/:id - Updates an existing car's information.

  • URL Parameters:
    • id (number): Car ID
  • Body: CarDTO object
  • Response:
    • Status: 204

DELETE /cars/:id - Deletes a car by ID.

  • URL Parameters:
    • id (number): Car ID
  • Response:
    • Status: 204

Notes

  • If you want to download the image directly from Docker Hub:

    docker pull ssavio/car-rental-api
  • For contributions and suggestions, feel free to open an issue or submit a pull request.


Thank you for using the Car Rental API! If you have any questions or need assistance, feel free to contact us.

License

Nest is MIT licensed.

About

The Car Rental API is a backend service designed for managing car rentals. Built with NestJS and TypeScript, it provides endpoints for user management, car inventory, and authentication.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published