This is the backend service for a movie rental service called "Vidly" programmed using nodejs as my first project in nodejs.
- ExpressJS based web server.
- MongoDB as the database service with the help of the popular package mongoose.
- Input validation using Joi
- Authentication and authorization services using JSON web tokens.
- Error handling and user friendly feedback.
- Logging using winston.
You can run this project localy if you have nodejs installed and have a mongodb server locally or on cloud.
- Clone the repository and go inside the folder
git clone https://github.com/mohotta/vidly
cd vidly
- Install dependencies
npm install
- Install nodemon for interactive experience (optional)
npm install -g nodemon
- export application configurations as env variables.
export vidly_APP_DB_URL=<DB_URL>
export vidly_APP_JWT_KEY=<JWT_PRIVATE_KEY>
export vidly_APP_PORT=<PORT_NO>
Or you can use .json
config files. Guide
- Run the project
node index.js
- If nodemon installed
nodemon index.js
├── config # env variable configuration settings
│ ├── ...
│ ├── ...
│ └── ...
├── middleware # Custom middleware functions for functionality
│ ├── ...
│ ├── ...
│ └── ...
├── models # Mongoose models and Joi validations for documents used in the project
│ ├── ...
│ ├── ...
│ └── ...
├── routes # Functions handling eah endpoint of the application
│ ├── ...
│ ├── ...
│ └── ...
├── services
│ └── db # Interactions with the database
│ ├── ...
│ ├── ...
│ └── ...
├── tests # Test scripts
│ ├── integration
│ │ ├── ...
│ │ ├── ...
│ │ └── ...
│ └── unit
│ ├── ...
│ ├── ...
│ └── ...
├── index.js # main file of the project
├── .gitignore
├── package.json
├── package-lock.json
└── README.md