DEV Community

Cover image for πŸš€ HNG Stage 0 β€” Dynamic Profile Endpoint
Victor Oluwayemi
Victor Oluwayemi

Posted on

πŸš€ HNG Stage 0 β€” Dynamic Profile Endpoint

This is my Stage 0 task for the HNG Internship (HNG13).
The goal was simple: build a RESTful API endpoint that returns my basic profile information along with a random cat fact fetched from an external API.

πŸ”— GitHub Repo: amiabl-programr/hng13-stage0-dynamic-profile-endpoint-project

🌐 Live Demo: View on Railway

πŸ› οΈ Work Process

I built the app using Express.js, a fast and minimalist Node.js framework.

Steps:

  • Created a /me endpoint that returns:
  • My name, email, and GitHub username
  • A random cat fact fetched via the Cat Facts API
  • Used Axios for external API requests
  • Implemented error handling for network issues and invalid routes
  • Structured the JSON response neatly for easy readability
app.get("/me", async (req, res) => {
try {
const { data } = await axios.get("https://catfact.ninja/fact");
res.json({
name: "Victor Oluwayemi",
github_username: "amiabl-programr",
email: "your_email@example.com",
cat_fact: data.fact,
});
} catch (error) {
res.status(500).json({ error: "Unable to fetch cat fact" });
}
});
Enter fullscreen mode Exit fullscreen mode

Handling Unknown Routes

The latest Express version no longer supports using a plain "*" wildcard.
Instead, I handled unknown routes like this:

app.use((req, res) => {
res.status(404).json({ error: "Route not found" });
});
Enter fullscreen mode Exit fullscreen mode

βš™οΈ Hosting Experience

This part was... interesting πŸ˜…

  • Tried Pxxl App β€” kept getting β€œNo service found”
  • Tried Azure (Student Account) β€” ran into hostname/DNS errors
  • Finally deployed on Railway, and it worked like magic πŸŽ‰ Railway dashboard

πŸ’‘ What This Task Taught Me

Even though the task seemed simple, I learned quite a few things:

  • How to use Axios effectively and handle errors gracefully
  • How route handling changed in newer versions of Express
  • The importance of understanding different deployment platforms
  • And of course, patience β€” because deployment β€œwahala” is real πŸ˜„ Successful JSON Output

✨ Final Thoughts

What started as a simple task turned into a mini learning journey β€” from backend structure to debugging, and finally deployment.

This project helped me:

  • Improve my understanding of Express.js
  • Get comfortable with error handling
  • Gain hands-on experience deploying Node.js apps to the cloud
  • I’m looking forward to the next stage of the HNG journey πŸš€

Built with ❀️ by Victor Oluwayemi

Top comments (0)