Giter Site home page Giter Site logo

vidly-api's Introduction

Vidly API

Movie rental API built as the final project for Node.js: The Complete Guide to Build RESTful APIs.

Online Demo

Access the following link to check the API running on the cloud, hosted on Heroku:

https://arcane-tor-20765.herokuapp.com/api/genres

How to Run

You will have to follow some steps to test the API.

1 - Install MongoDB

To run this project, you need to install the latest version of MongoDB Community Edition first.

https://docs.mongodb.com/manual/installation/

2 - Install Node.js

Download and install Node.js. Make sure to download and install the latest stable version (LTS).

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

To check if Node.js was installed succesfully, run the following command in terminal or command prompt:

node --version

You should see an output like this:

v10.13.0

It indicates that Node.js is running.

2 - Install the API Dependencies

Open the project folder using the terminal or command prompt, then type the following:

npm i

The command above will install all node modules needed for the API to run. If you are using Linux or MacOS and receive a permission denied message, use sudo.

3 - Run the Tests

After installing all dependencies, run the following command to execute all unit and integration tests, to assert that the app is ready to be executed:

npm test

All tests should pass. It may take a while to execute.

4 - Set the Environment Variables

You will have to set an environment variable to use as the secure key for JSON web tokens of the app. If you are using Linux or MacOS, run the following command:

export vidly_jwtPrivateKey=SomeSecureKeyHere

If you are using Windows, use the following command:

set vidly_jwtPrivateKey=SomeSecureKeyHere

5 - Running the Server

After following all steps above, you are ready to start the server. Type the following in the terminal or command prompt:

node index.js

This is going to run the application on port 3000. If this port is busy, the API will run in a different port. You can check the output to see in which port the API is running.

Navigate to http://localhost:3000/api/genres. If everything is ok, you should receive a response like this:

{
  "success": true,
  "data": []
}

The API exposes the following REST routes:

/api/genres
/api/customers
/api/movies
/api/rentals
/api/returns
/api/users
/api/auth

Go ahead and play around with the API to check the available operations.

vidly-api's People

Contributors

evgomes avatar dependabot[bot] avatar prateek3112 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.