Student Management API Server for Keploy Fellowship.
This is a full-stack Student Management API built using Node.js, Express, MongoDB Atlas, and an optional HTML + JS frontend. It allows users to Create, Read, Update, and Delete (CRUD) student records.
- 📦 RESTful API using Express
- 💾 MongoDB Atlas integration with Mongoose
- 🔧 CRUD operations for student data
- 🌐 Simple HTML + JS frontend
- 🧪 Tested using
curl
, Jest & Supertest - 🎥 Keploy used to record test sessions
student-api-server/ │ ├── config/ │ └── db.js # MongoDB connection config │ ├── controllers/ │ └── studentController.js # API logic (CRUD functions) │ ├── models/ │ └── studentModel.js # Mongoose schema │ ├── routes/ │ └── studentRoutes.js # Express routes │ ├── public/ │ └── index.html # (Optional) Frontend UI │ ├── tests/ │ └── students.test.js # Jest + Supertest test cases │ ├── .env # Environment variables ├── .gitignore ├── package.json ├── server.js # App entry point └── README.md # This file
Method | Endpoint | Description |
---|---|---|
GET | /api/students | Get all students |
POST | /api/students | Add a new student |
PUT | /api/students/:id | Update a student by ID |
DELETE | /api/students/:id | Delete a student by ID |
- Backend: Node.js, Express.js
- Database: MongoDB Atlas, Mongoose
- Frontend (Optional): HTML + JavaScript (Fetch API)
- Testing: Jest, Supertest, Curl
- Test Recorder: Keploy
- Platform: Git, GitHub, WSL2 (Ubuntu)
-
Clone the repository:
git clone https://github.com/kishorecodesinpython/student-api-server.git cd student-api-server
-
Install dependencies:
npm install
-
Create
.env
file and add Mongo URI:PORT=5000 MONGO_URI=mongodb+srv://arinkishore7:Arin%402283@cluster0.93nt3ru.mongodb.net/keployDB?retryWrites=true&w=majority&appName=Cluster0
-
Start the server:
npm run dev
-
Open in browser: Visit
http://localhost:5000
to use the frontend.
This project includes API tests written using Jest and Supertest.
POST /api/students
→ Add new studentGET /api/students
→ Get all students
npm test
Through this task, I learned:
- Building and connecting an API with MongoDB Atlas
- Creating a simple UI with HTML + JS for real-time interaction
- Using Keploy to record and replay API calls
- Writing tests with Jest and Supertest
- Interpreting and improving test coverage