An API backend for the Natours project using Node.js, Express, Pug, and following the MVC architecture. Originally part of the Udemy course by Jonas Schmedtmann.
This project is the backend for the Natours project, implementing a RESTful API using Node.js and Express. It follows the MVC (Model-View-Controller) architecture and uses Pug as the view engine.
- RESTful API endpoints for managing tours, users, reviews, etc.
- MVC architecture for clean code organization.
- Pug templates for dynamic HTML rendering.
- Authentication and authorization for secure endpoints.
- MongoDB with mongoose client
- MongoDB geospatial queries
- MapBox
- SMTP with Brevo
Before you begin, ensure you have met the following requirements:
- Node.js installed
- npm (Node Package Manager) installed
- MongoDB installed and running
-
Clone the repository:
git clone https://github.com/MoSobhy01/Natours
-
Navigate to the project directory:
cd Natours
-
Install dependencies:
npm install
-
Configure environment variables:
Create a
.env
file in the root directory and add the following:NODE_ENV=development PORT=8000 DATABASE_PASSWORD=... DATABASE=... DATABASE_LOCAL=... JWT_SECRET=... JWT_EXPIRES_IN=... JWT_EXPIRES_IN_d=... EMAIL_HOST=... EMAIL_PORT=... EMAIL_USER=... EMAIL_PASS=... EMAIL_ADDERESS=... BREVO_USER=... BREVO_PASSWORD=...
-
Start the server:
npm start
-
Access the API at http://localhost:8000
- Fork the project.
- Create your feature branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Jonas Schmedtmann - For the original Natours project on Udemy.