This project is an API built using the MVC architecture, with authentication using JWT and role-based authorization
- MVC architecture for organized code structure
- User authentication using JWT (JSON Web Tokens)
- Role-based authorization for controlling access to different resources
- Data Models: [user, Tour , reviews]
- Aggregation Pipelining
- Secret Tours
- Clone the repository:
git clone https://github.com/your-username/your-repo.git - Install dependencies:
npm install
you need to add following in config.env:
- NODE_ENV=development
- PORT=3000
- DATABASE="mongodb+srv://hello:@cluster0.dsf.mongodb.net/sdf?retryWrites=true&w=majority&appName=cluster0"
- DATABASE_LOCAL=mongodb://localhost:27017/natours
- DATABASE_PASSWORD=oF4y39r8we98r
- DBUSER = adfslkdjf
- JWT_SECRET= apple-day-keep-doc-away
- JWT_EXPIRES_IN=90d
- JWT_COOKIE_EXPIRES_IN=90
- EMAIL_USERNAME=105a0esdfsdfsd
- EMAIL_PASSWORD=5ccf9fdfjknskdjf
- EMAIL_HOST=sandbox.smtp.mailtrap.io
- EMAIL_PORT=25
- Start the server:
npm start
Note: there may different type of request on each route (get,post,patch,delete)
- api/v1/tours/
- api/v1/tours/:tourId
- api/v1/tours/:tourId/reviews
- api/v1/tours/top-5-cheap
- api/v1/tours/tour-stats
- api/v1/tours/monthly-plan/:year
- api/v1/tours/tours-within/:distance/center/:latlng/unit/:unit
- api/v1/tours/distances/:latlng/unit/:unit
Note: there may different type of request on each route (get,post,patch,delete)
- api/v1/users/signup
- api/v1/users/login
- api/v1/users/forgotPassword
- api/v1/users/resetPassword
- api/v1/users/updateMyPassword
- api/v1/users/updateMe
- api/v1/users/deleteMe
- api/v1/users/me
- api/v1/users/
- api/v1/users/:id
- api/v1/reviews/
- api/v1/reviews/:id
- Node.js
- Express.js
- Mongoose
- MongoDB
- Many Security node modules