This assignment focuses on building a RESTful API using Express.js, implementing proper routing, middleware, and error handling.
You will:
- Set up an Express.js server
- Create RESTful API routes for a product resource
- Implement custom middleware for logging, authentication, and validation
- Add comprehensive error handling
- Develop advanced features like filtering, pagination, and search
- Accept the GitHub Classroom assignment invitation
- Clone your personal repository that was created by GitHub Classroom
- Install dependencies:
npm install
- Run the server:
npm start
Week2-Assignment.md
: Detailed assignment instructionsserver.js
: Starter Express.js server file.env.example
: Example environment variables file
- Node.js (v18 or higher)
- npm or yarn
- Postman, Insomnia, or curl for API testing
The API will have the following endpoints:
GET /api/products
: Get all productsGET /api/products/:id
: Get a specific productPOST /api/products
: Create a new productPUT /api/products/:id
: Update a productDELETE /api/products/:id
: Delete a product
Your work will be automatically submitted when you push to your GitHub Classroom repository. Make sure to:
- Complete all the required API endpoints
- Implement the middleware and error handling
- Document your API in the README.md
- Include examples of requests and responses