A simple Node.js + Express.js project that provides a RESTful API for managing courses (CRUD Operations).
The API supports creating, reading, updating, and deleting courses with validation using express-validator
.
API CodeZone/
│── Controllers/
│ └── Courses.controllers.js
│── Data/
│ └── Courses.js
│── MiddleWares/
│ └── ValidationSchema.js
│── Routers/
│ └── Courses.Router.js
│── index.js
│── package.json
│── package-lock.json
-
Clone the repository
git clone <repo-link> cd API-CodeZone
-
Install dependencies
npm install
-
Run the server
nodemon index.js
The server will start on:
http://localhost:3000
GET /api/Courses
GET /api/Courses/:CourseId
POST /api/Courses
Request Body:
{
"title": "React",
"price": 4000
}
PATCH /api/Courses/:CourseId
DELETE /api/Courses/:CourseId
- title: must not be empty and must be at least 2 characters.
- price: must not be empty, must be an integer, and must be greater than or equal to 100.
A simple API performing CRUD operations on courses.
The project demonstrates:
- Express.js Routers & Controllers
- Middleware usage
- Data handling in memory
- Request validation with
express-validator
Developed as a practice project for learning Node.js and Express.js.