Live
Black Hat USADark ReadingBlack Hat AsiaAI BusinessMarch 2026 LinksLessWrong AIPolymarket Kalshi ArbitrageDEV CommunityBMAD-Method: AI-Driven Agile Development That Actually Works (Part 1: Core Framework)DEV CommunityBehind the Scenes: How Database Traffic Control WorksDEV CommunityWe Built the Same Agent Three Times Before It WorkedDEV CommunityWhy Cybersecurity Compliance Is Now a Strategic Business Asset — Not Just a Legal ObligationDEV CommunityScan Any Document to a Searchable PDF For Free, Right in Your BrowserDEV CommunityAI Writes Better UI Without React Than With ItDEV CommunityScan Any Document to a Searchable PDF — For Free, Right in Your BrowserDEV CommunityWhy LLM orchestration is broken (and how cryptographic agent identities fix it)DEV CommunityBeyond the Hype: A Practical Guide to Integrating AI into Your Development WorkflowDEV CommunityBoston Becomes First Major District to Bring AI Literacy Into Classrooms - GoverningGoogle News: AIBlack Hat USADark ReadingBlack Hat AsiaAI BusinessMarch 2026 LinksLessWrong AIPolymarket Kalshi ArbitrageDEV CommunityBMAD-Method: AI-Driven Agile Development That Actually Works (Part 1: Core Framework)DEV CommunityBehind the Scenes: How Database Traffic Control WorksDEV CommunityWe Built the Same Agent Three Times Before It WorkedDEV CommunityWhy Cybersecurity Compliance Is Now a Strategic Business Asset — Not Just a Legal ObligationDEV CommunityScan Any Document to a Searchable PDF For Free, Right in Your BrowserDEV CommunityAI Writes Better UI Without React Than With ItDEV CommunityScan Any Document to a Searchable PDF — For Free, Right in Your BrowserDEV CommunityWhy LLM orchestration is broken (and how cryptographic agent identities fix it)DEV CommunityBeyond the Hype: A Practical Guide to Integrating AI into Your Development WorkflowDEV CommunityBoston Becomes First Major District to Bring AI Literacy Into Classrooms - GoverningGoogle News: AI

30-Day Cloud & DevOps Challenge: Day 2 — Building My First Backend API

DEV Communityby MichelleApril 1, 20265 min read1 views
Source Quiz

<p><strong>The journey continues!</strong> After setting up my project structure on Day 1, today was all about building the heart of my microservices platform: the backend API.</p> <p><em>If you missed Day 1, you can catch up here: [<a href="https://dev.to/michellewanjiru/day-1-of-my-30-day-cloud-devops-challenge-project-setup-2a5a?trk=public_post_comment-text">https://dev.to/michellewanjiru/day-1-of-my-30-day-cloud-devops-challenge-project-setup-2a5a?trk=public_post_comment-text</a>]</em></p> <h2> What I Set Out to Do Today </h2> <p>Build a working REST API that can:</p> <ul> <li>Respond to HTTP requests</li> <li>Return JSON data</li> <li>Serve as the foundation for my microservices platform</li> </ul> <p><strong>Simple, right?</strong> Well... let me share how it actually went.</p> <h2>

The journey continues! After setting up my project structure on Day 1, today was all about building the heart of my microservices platform: the backend API.

If you missed Day 1, you can catch up here: [https://dev.to/michellewanjiru/day-1-of-my-30-day-cloud-devops-challenge-project-setup-2a5a?trk=public_post_comment-text]

What I Set Out to Do Today

Build a working REST API that can:

  • Respond to HTTP requests

  • Return JSON data

  • Serve as the foundation for my microservices platform

Simple, right? Well... let me share how it actually went.

The Tech Stack I Chose

I decided to go with Node.js + Express for my backend because:

  • JavaScript is everywhere (frontend, backend, even DevOps tools)

  • Express is lightweight and beginner-friendly

  • I already had Node.js installed on my Ubuntu system

Step-by-Step: What I Actually Did

1. Initial Setup

cd backend npm init -y # Creates package.json npm install express # Web framework npm install --save-dev nodemon # Auto-restarts server on changes

Enter fullscreen mode

Exit fullscreen mode

What I learned: package.json is like a shopping list for your project. Every tool you add gets listed there, making it easy to share your project with others.

2. Writing My First Server

I created server.js with three endpoints:

const express = require('express'); const app = express(); const PORT = 8000;

// Root endpoint app.get('/', (req, res) => { res.json({ message: 'Welcome to the Microservices Platform API', status: 'running' }); });

// Health check endpoint app.get('/health', (req, res) => { res.json({ status: 'healthy', service: 'backend-api', timestamp: new Date().toISOString() }); });

// Users endpoint (mock data for now) app.get('/users', (req, res) => { res.json([ { id: 1, name: 'Alice', email: '[email protected]' }, { id: 2, name: 'Bob', email: '[email protected]' }, { id: 3, name: 'Charlie', email: '[email protected]' } ]); });

app.listen(PORT, () => { console.log( Server running on http://localhost:${PORT}); });`

Enter fullscreen mode

Exit fullscreen mode

Understanding each part:

  • app.get() defines what happens when someone visits a URL

  • (req, res) => {} is a function that handles the request and sends a response

  • res.json() sends data back as JSON (the language of APIs)

3. The Challenge That Almost Stopped Me

I tried running my server with:

npm run dev

Enter fullscreen mode

Exit fullscreen mode

And got this error:

npm error Missing script: "dev"

Enter fullscreen mode

Exit fullscreen mode

My reaction: 😅 Wait, what? I thought I had this!

How I diagnosed it:

npm run # Shows all available scripts

Enter fullscreen mode

Exit fullscreen mode

Only test was showing. I had completely forgotten to add the "dev" script to my package.json!

The fix: I opened package.json and added:

"scripts": {  "start": "node server.js",  "dev": "nodemon server.js" }

Enter fullscreen mode

Exit fullscreen mode

Lesson learned: Never assume your configuration is correct. Always verify with simple commands.

4. The Moment It Finally Worked

After fixing the script, I ran:

npm run dev

Enter fullscreen mode

Exit fullscreen mode

And saw:

Server running on http://localhost:8000

Enter fullscreen mode

Exit fullscreen mode

Then in another terminal:

curl http://localhost:8000/

Enter fullscreen mode

Exit fullscreen mode

Response:

{"message":"Welcome to the Microservices Platform API","status":"running"}

Enter fullscreen mode

Exit fullscreen mode

I literally cheered in my chair.🎉 My first API was alive!

Testing All Endpoints

Here's what each endpoint returned:

Endpoint Response

GET / Welcome message

GET /health Service status with timestamp

GET /users List of 3 mock users

All working perfectly!

Key Learnings from Day 2

Technical Concepts I Gained:

  • HTTP Methods: GET is how you retrieve data from a server

  • JSON: The universal language of APIs — both request and response

  • Ports: Think of them like doors — 8000 is the door my API listens on

  • Endpoints: Specific URLs that do specific things (/health, /users)

  • Package.json scripts: Custom commands to automate repetitive tasks

Problem-Solving Skills:

  • Diagnosing errors: npm run helped me see what was actually available

  • Reading error messages: "Missing script" told me exactly what was wrong

  • Step-by-step verification: Test each piece before assuming everything works

Mindset Shifts:

  • Done is better than perfect: My first API doesn't have a database yet, and that's okay

  • Celebrate small wins: Getting that first curl response was genuinely exciting

  • Embrace mistakes: The missing script error taught me more than if everything worked perfectly

Tips for Anyone Starting Their Own API

  • Start simple. My API only does 3 things right now — that's enough!

  • Test as you go. Don't write 100 lines of code before testing. Test after each endpoint.

  • Use curl or browser. It's satisfying to see your API respond in real-time.

  • Save your package.json changes. I almost forgot this one!

  • Keep notes. Document what you learn, especially the mistakes.

A Quick Thank You

To everyone following along and the community helping me debug, your support means everything. Special shoutout to those who reminded me to check my package.json scripts!

What's Next (Day 3)

Tomorrow, I'm building a frontend that will:

  • Fetch data from my API

  • Display the list of users

  • Show the health status

It's going to be the first time my frontend and backend talk to each other!

Links & Resources

  • GitHub Repository: Production-Ready-Microservices-Platform

  • Express Documentation: expressjs.com

  • Nodemon: nodemon.io

Let's Connect!

Are you also learning backend development? Building your first API? I'd love to hear about your journey!

Drop a comment below or connect with me on LinkedIn at https://www.linkedin.com/in/michelle-wanjiru-420877275/?lipi=urn%3Ali%3Apage%3Ad_flagship3_detail_base%3BHw%2F74ryNQ7CjXqDkL3k7eQ%3D%3D. Let's learn together!

This is Day 2 of my 30-Day Cloud & DevOps Challenge. Follow along as I build a complete microservices platform from scratch!

Was this article helpful?

Sign in to highlight and annotate this article

AI
Ask AI about this article
Powered by AI News Hub · full article context loaded
Ready

Conversation starters

Ask anything about this article…

Daily AI Digest

Get the top 5 AI stories delivered to your inbox every morning.

More about

availableproductplatform

Knowledge Map

Knowledge Map
TopicsEntitiesSource
30-Day Clou…availableproductplatformservicegithubrepositoryDEV Communi…

Connected Articles — Knowledge Graph

This article is connected to other articles through shared AI topics and tags.

Knowledge Graph100 articles · 152 connections
Scroll to zoom · drag to pan · click to open

Discussion

Sign in to join the discussion

No comments yet — be the first to share your thoughts!

More in Products