This is a basic guide to setting up an Express.js application using Git for version control and Yarn as the package manager. This setup includes integration with MongoDB, a popular NoSQL database.
To install git and set up your project repository:
- Create a new directory for your project:
mkdir <project-dirname> - Change into your project directory:
cd <project-dirname> - Initialize a new Git repository:
git init - Create an empty Git repository on a platform like GitHub or GitLab
- Add the remote repository URL to your local repository:
git remote add origin <repository clone url>
To set up Yarn as your package manager:
- Download and install Yarn from Yarn Installation Guide
- Ensure you are in your project directory:
cd <project-dirpath> - Initialize your project with Yarn:
yarn init -y
- To install all the project dependencies defined in your
package.json, run:yarn install
- Start your Express application using Yarn:
yarn start
To run tests for your application, use the following command:
yarn test
For manual build and setup from scratch, follow these steps:
- Generate an Express skeleton application:
npx express-generator. For more details, refer to the Express Application Generator guide. - Copy following dependencies into
package.jsonobject:"dependencies": { "axios": "^1.6.5", "cookie-parser": "~1.4.4", "debug": "~2.6.9", "express": "~4.16.1", "http-errors": "~1.6.3", "jade": "~1.11.0", "mongodb": "^6.3.0", "morgan": "~1.9.1" }, "devDependencies": { "jest": "^29.7.0", "node-mocks-http": "^1.14.1", }
yarn install
Postman is a popular API client that makes it easy to create, share, test, and document APIs. It offers a straightforward user interface for sending HTTP requests and viewing responses.
- Download and installation instructions: Download Postman
Mongo Compass is the official GUI for MongoDB. It allows you to visually explore your data, run queries, and interact with your MongoDB database.
- Download and installation instructions: Download MongoDB Compass
- For more information on the Express Application Generator, visit Express Application Generator.
- For a comprehensive guide on MongoDB Data Model Design, see the "Data Model Design for MongoDB.pdf" file located in the root directory of this project. Might be outdated as it was public at 2015.