Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 1.1 KB

README.md

File metadata and controls

28 lines (21 loc) · 1.1 KB

movie-rest-api

Creating REST API for movie using Node.js express framework.

How to start the app

  • Create folder config in the root directory
  • Add file database.js inside the config directory
  • In the database.js file, add the url of the mongoose database connection similar as below (replace username, password and database name)
const DATABASECONNECTION = "mongodb+srv://<username:password>@cluster0.atx9j.mongodb.net/<database-name>?retryWrites=true&w=majority"

module.exports = { DATABASECONNECTION }
  • Run npm install and npm start or use npm run dev (to start with nodemon)

Start with docker

  • Build docker image: docker build --tag name-of-the-app .
  • Run the app with docker: docker run -it -p 3000:3000 name-of-the-app (map the available port in local machine to docker machine: 3000:3000)

When the server is up

Test the application

  • Run npm test

Note

  • In the project folder, there is movie collection ready to import to the MongoDB database
  • Also, Postman collection