Objective: Develop a Node.js Express application with TypeScript as the programming language, integrating MongoDB with Mongoose for user data and order management. Ensure data integrity through validation using Zod. This application is developed using Node.js, Express, MongoDB, and TypeScript.
Before you begin, ensure you have met the following requirements:
- Node.js installed
- MongoDB Atlas account (or your local MongoDB server)
- MongoDB connection string
- Your environment variables in a
.env
file (similar to the provided.env
example)
-
Clone the repository:
git clone https://github.com/riasat97/L2-B2-assignment-2
-
Navigate to the project directory:
cd L2-B2-assignment-2
-
Install dependencies:
npm install
-
Create a .env file in the root directory and add your environment variables:
NODE_ENV=development PORT=5000 DATABASE_URL=mongodb+srv://your-username:your-password@cluster0.mongodb.net/your-database?retryWrites=true&w=majority BCRYPT_SALT_ROUNDS=12
Replace your-username, your-password, and your-database with your MongoDB Atlas credentials.
-
Start the application:
npm run start:dev
The application will be available at http://localhost:5000.