DEV Community

ALI OGOCHUKWU PETER
ALI OGOCHUKWU PETER

Posted on

My Journey Completing the HNG Internship Stage 0 Backend Task 🚀🐱

I just wrapped up the HNG Internship Stage 0 Backend Task as part of the #HNGi13 program, and I’m thrilled to share my experience! I built a RESTful API using Node.js and Express that serves a /me endpoint, returning my profile information and a dynamic cat fact fetched from the Cat Facts API. Here’s a deep dive into my process, challenges, and what I learned.

What I Built

The task was to create a GET /me endpoint that returns a JSON response with:
status: Always "success"
user: My email, name, and backend stack
timestamp: Current UTC time in ISO 8601 format
fact: A random cat fact fetched from the Cat Facts API

Below are visuals of my work:


My Express server code handling the /me endpoint.


The JSON response from my live API.


My Railway deployment dashboard showing the successful build.

My Work Process
Setting Up the API: I used Express to create a lightweight server and axios to fetch cat facts. I ensured the endpoint returns the exact JSON structure required, with dynamic timestamps using new Date().toISOString().

Error Handling: I implemented try-catch blocks to handle potential failures of the Cat Facts API, returning a fallback error response with a 500 status code if needed.

Environment Variables: I used dotenv to manage the server port, keeping sensitive configurations secure.

Deployment: I deployed the API on Railway (since Vercel and Render were not allowed). I faced a challenge with a node_modules warning in the build log, which I resolved by adding node_modules/ to my .gitignore and redeploying.

Documentation: I wrote a clear README.md for my GitHub repo, but initially, it rendered poorly due to missing Markdown formatting. I fixed this by adding proper headings and code blocks, making it professional and easy to follow.

Challenges Faced
Railway Deployment: Finding the public URL was tricky at first, as it wasn’t auto-generated. I learned to use the Railway dashboard’s Networking section to generate a domain.

README Formatting: My initial README looked like plain text on GitHub. I revised it with proper Markdown syntax (e.g., #, ##,


bash) to make it visually appealing.

Dynamic Data: Ensuring the cat fact and timestamp updated on every request required careful testing with Postman to confirm the API wasn’t caching responses.

What I Learned
Third-Party API Integration: Consuming the Cat Facts API taught me how to handle external API calls and manage timeouts/errors gracefully.

UTC Timestamps: I got hands-on experience formatting dates in ISO 8601 (e.g., 2025-10-18T12:34:56.789Z).

Deployment Best Practices: Deploying on Railway and resolving issues like the node_modules warning deepened my understanding of cloud platforms.

Documentation: Writing a clear, well-formatted README is crucial for open-source projects.

Git Hygiene: Using .gitignore to keep my repo clean was a valuable lesson.

Check Out My Work
GitHub Repository: https://github.com/Ali-Peter/hng-13-stage-0
Live API: https://hng-13-stage-0-production-51a2.up.railway.app/me

What’s Next?
I’m excited to continue my journey in the HNG Internship and tackle more backend challenges. I’d love to hear your feedback or tips for improving my API! Feel free to test the endpoint or check out my code. 💻

#HNGi13 #Backend #NodeJS #API #WebDevelopment #JavaScript #ExpressJS
Enter fullscreen mode Exit fullscreen mode

Top comments (1)