Skip to content

nflaig/car-rental-api

Repository files navigation

Introduction

This project is a implementation of a Car Rental API in Node.js. It uses Express as web framework and MongoDB as database. The code is fully covered by tests, using Jest.

The application allows new users to register and authenticate by using JSON Web Tokens. Registered users are able to rent a car and return it at any time. Admins have additional privileges such as adding new cars to the database or viewing all active rentals.

Installation

In order to run the application on your local machine some requirements need to be installed.

Node.js

Install npm which is distributed with Node.js.

https://nodejs.org/en/download/

MongoDB

Install MongoDB and make sure the database server is running.

https://www.mongodb.com/download-center/community

Dependencies

Change the directory to the project folder and install the dependencies.

npm install

Tests

Run the tests to make sure everything is installed correctly and working.

npm test

Usage

Finally, start the Node web server.

npm start

The application will run on http://localhost:3000 by default. If the port is already in use, it can be changed by setting the PORT environment variable. The easiest way to interact with the server is by installing a API development environment such as Postman.

License

Code released under the MIT License.