Building the Backbone – API Endpoints with Node.js (Day -16)
Constructing the API Layer – Connecting Data to Frontend
After understanding the full system architecture yesterday, today I stepped into the actual development phase, starting with building the API endpoints using Node.js and Express-like vanilla setup (or lightweight custom structure).
These APIs will serve as the bridge between our backend logic (like Codeforces data fetching, syncing, filtering, etc.) and the React frontend that presents it all to the user.
API Endpoints Created:
Here’s a summary of the routes I implemented today:
Student Routes
Method Endpoint Description GET
/getStudentsIdAndHandle
Returns only students' IDs and Codeforces handles PATCH
/toggleReminder/:studentId
Toggles reminder email status for a student GET
/submissions/:id
Fetches all Codeforces submissions for a student GET
/contestHistory/:id
Fetches Codeforces contest history for a student GET
/
Returns a list of all students POST
/
Adds a new student to the database PUT
/:id
Updates a student’s information DELETE
/:id
Deletes a student from the database GET
/:id
Gets full detail of a specific student
Method | Endpoint | Description |
---|---|---|
GET | /getStudentsIdAndHandle | Returns only students' IDs and Codeforces handles |
PATCH | /toggleReminder/:studentId | Toggles reminder email status for a student |
GET | /submissions/:id | Fetches all Codeforces submissions for a student |
GET | /contestHistory/:id | Fetches Codeforces contest history for a student |
GET | / | Returns a list of all students |
POST | / | Adds a new student to the database |
PUT | /:id | Updates a student’s information |
DELETE | /:id | Deletes a student from the database |
GET | /:id | Gets full detail of a specific student |
What I Learned:
-
How to structure RESTful APIs for a clean and scalable backend
-
Used Express.Router()
logic for modular routing
-
Implemented query params, route params, and middleware structure
-
Prepared APIs in a way that the frontend can easily fetch and display insights (e.g., contest stats, submission history)
How to structure RESTful APIs for a clean and scalable backend
Used Express.Router()
logic for modular routing
Implemented query params, route params, and middleware structure
Prepared APIs in a way that the frontend can easily fetch and display insights (e.g., contest stats, submission history)
Gracias:
I’m thankful for the clarity that planning APIs brings. It’s not just coding — it’s designing a bridge between user experience and data.
Feeling proud of how structured the backend is shaping up. Tomorrow, I’ll move toward connecting this backend to the frontend or mocking the frontend dashboard view with test data.
~ Sanya
Comments
Post a Comment