DEV Community

Fiyinfoluwa Ojo
Fiyinfoluwa Ojo

Posted on

RESTful Design & Routes: Organizing Your API Like a Pro

What is REST?

REST (Representational State Transfer) is a set of rules for designing
clean, predictable APIs. Instead of random endpoints, REST gives your
API structure that any developer can understand instantly.

Why Route Design Matters

Bad API:

  • /getUser
  • /fetchAllPosts
  • /doLogin

Good REST API:

  • /users
  • /posts
  • /auth/login

Clean, predictable, and organized.

My 3 Routes for Day 2

For Day 2 of the GDGoC Bowen 30-Day Challenge, I designed 3 structured routes:

Route Method Description
/ GET Home - Welcome message
/about GET About the API
/status GET Health check

The Code

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def home():
    return {
        "msg": "Welcome to my API",
        "version": "1.0",
        "track": "Backend Development"
    }

@app.get("/about")
def about():
    return {
        "name": "Fiyinfoluwa Ojo",
        "challenge": "GDGoC Bowen 30 Day Challenge",
        "track": "Backend Development",
        "day": 2
    }

@app.get("/status")
def status():
    return {
        "status": "up",
        "message": "Server is running smoothly"
    }

Enter fullscreen mode Exit fullscreen mode

Here's the live response from all 3 endpoints:

Home endpoint response

About endpoint response

Status endpoint response

The /status Route — Why It Matters

Every production API has a health check endpoint.
It tells you instantly if your server is up or down
without touching any real data. Simple but critical in real systems.

Lessons Learned

REST isn't just about making endpoints work —
it's about making them make sense.
Structure your API like you're building for a team, not just yourself.

Day 2 done. 28 more to go. 🔥

GDGoCBowen30dayChallenge

Top comments (0)