RESTful Design & Routes: Organizing Your API Like a Pro
Source: Dev.to
What is REST?
REST (Representational State Transfer) is a set of rules for designing APIs.
Bad API examples
/getUser/fetchAllPosts/doLogin
Good REST API examples
/users/posts/auth/login
Clean, predictable, and organized.
Structured Routes (Day 2 of the GDGoC Bowen 30‑Day Challenge)
| Route | Method | Description |
|---|---|---|
/ | GET | Home – Welcome message |
/about | GET | About the API |
/status | GET | Health check |
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"
}
Live Response
Every production API has a health‑check endpoint.
Day 2 done. 28 more to go. 🔥