I just completed my first backend project for the HNG Internship, and I wanted to share what I learned along the way. It's a simple API, but getting it right taught me more than I expected.
What I Built
A REST API endpoint that returns user information alongside random cat facts. Simple concept, but the details matter.
Live endpoint: https://hng-backend-sodf.onrender.com/me
The response looks like this:
{
"status": "success",
"user": {
"email": "uchennapeace2003@gmail.com",
"name": "Onoh Uchenna Peace",
"stack": "Node.js/Express"
},
"timestamp": "2025-10-19T12:34:56.789Z",
"fact": "Cats have over 20 vocalizations..."
}
The Requirements That Made Me Think
The project specs seemed straightforward at first:
- Create a GET endpoint at
/me - Return JSON with specific fields
- Integrate with the Cat Facts API
- Use ISO 8601 timestamp format
But then came the details that matter: the timestamp must update with every request, the cat fact must be fresh each time, and error handling matters.
What I Learned
1. APIs Don't Live on Root Routes
My first mistake? Visiting https://my-app.com/ and seeing "Cannot GET /". Of course it can't—I defined the route at /me. URLs in web APIs work like addresses: you need the full path, not just the building name.
2. Error Handling Isn't Optional
What happens when the Cat Facts API goes down? Your API shouldn't crash. I added a graceful fallback that still returns valid JSON with a friendly message. Production code needs to handle failure scenarios.
3. Timestamps Are Trickier Than They Look
ISO 8601 format isn't just new Date(). It's new Date().toISOString(). Small detail, big difference. And it needs to reflect the current moment of each request—not a cached value.
4. Testing What You Build
I created a test script that validates:
- Response structure matches the schema
- Timestamp updates dynamically
- Cat facts change between requests
- All required fields are present
Running tests before submission saved me from multiple gotchas.
The Tech Stack
Backend: Node.js with Express
HTTP Client: Axios for external API calls
Deployment: Render (auto-deploys from GitHub)
External API: Cat Facts API
The code is clean, handles errors gracefully, and includes proper CORS headers for cross-origin requests.
Deployment Surprises
Render ran yarn install instead of npm install. I panicked for a second—was this going to break things? Nope. Both package managers read the same package.json. The app worked perfectly.
Lesson: Don't sweat the small stuff when it doesn't actually affect functionality.
What's Next
This project taught me that good APIs are about more than just returning data. They're about:
- Reliability (handling failures)
- Consistency (following standards like ISO 8601)
- Documentation (so others know how to use it)
- Testing (so you know it works)
Next up, I'm diving deeper into authentication, databases, and building more complex endpoints.
Try It Yourself
Hit the endpoint: https://hng-backend-sodf.onrender.com/me
Each request gives you a new cat fact. Refresh it a few times—you'll see the timestamp and facts change in real-time.
GitHub Repository: [https://github.com/RaDiant-1/Hng-backend]
This project was built as part of the HNG Internship program. If you're interested in backend development opportunities, check out HNG Internship and HNG Hire for connecting with talented developers.
What was your first API project like? Drop a comment—I'd love to hear your experiences! 👇
Top comments (0)