This is a basic project to practice routing using Express.js, a popular web framework for Node.js. The goal is to gain hands-on experience working with different types of HTTP routes, parameters, and middleware.
These instructions will help you get a copy of the project up and running on your local machine for development and testing purposes.
Make sure you have the following installed:
- Node.js
- npm
- git - For handling your repositories.
- Visual Studio Code - This is one of the most popular IDE's, but you can use any other, or any code editor.
git clone https://github.com/your-github-username/your-repo-name.git
cd your-repo-name
npm install
node index.js
The server will start on localhost:3000
(unless specified otherwise in the code. For my code, I specified Port 3001).
express-routing-practice/
│
├── index.js # Main entry point
├── routes/
│ ├── user.js # Routes related to users
│ └── product.js # Routes related to products
├── package.json
└── README.md
- Basic routing with
app.get
,app.post
, etc. - Route parameters (
/users/:id
) - Middleware usage
- Modular routing with
express.Router()
- Response handling
Feel free to fork this repository, create a new branch, and submit a pull request.
This project is open source and available under the MIT License.