0Pricing
FastAPI Backend Development Bootcamp · 강의

첫 API 엔드포인트

간단한 GET 엔드포인트를 만들고 경로를 정의하며 기본 JSON 응답을 반환하는 방법을 배웁니다.

첫 API 엔드포인트은(는) CoddyKit의 무료 FastAPI Backend Development Bootcamp 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 FastAPI Backend Development Bootcamp 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. FastAPI Backend Development Bootcamp 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

What's an API Endpoint?

An API endpoint is a specific URL your API exposes — an address that receives requests and returns a service. We start with GET, used to fetch data.

Your FastAPI Application

Every app starts from a FastAPI instance, conventionally named app. This object is the core where all your routes and logic live.

from fastapi import FastAPI

app = FastAPI()

# This 'app' object is where your API lives!

Defining Routes with Decorators

FastAPI uses decorators to bind a URL path to a function. @app.get("/") says: on a GET to the root path, run the function below.

Your First 'Hello World' Endpoint

Here is the classic API Hello World — a single GET endpoint at /. Run it and hit the root in your browser or Postman.

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"message": "Hello, CoddyKit!"}

# To run: Save as main.py, then 'uvicorn main:app --reload'

Running Your FastAPI App

Run your app with Uvicorn: uvicorn main:app --reload finds app in main.py and auto-restarts whenever you edit code.

FastAPI's JSON Magic

FastAPI's JSON magic: return a Python dict or list and it serializes to a JSON response automatically — no manual conversion needed.

Returning Structured JSON Data

Return a richer Python dict and FastAPI ships it as structured JSON. Here, an endpoint hands back full product details.

from fastapi import FastAPI

app = FastAPI()

@app.get("/product")
def get_product_info():
    return {
        "id": "CK001",
        "name": "CoddyKit Pro Course",
        "price": 49.99,
        "available": True
    }

# Run with: uvicorn main:app --reload
# Access this endpoint at /product

Creating Multiple Endpoints

An API has many endpoints, each for a different resource. Define as many as you need on one app — here, two distinct GET routes.

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"message": "Welcome to our API!"}

@app.get("/items")
def get_items():
    return [
        {"id": 1, "name": "Laptop"},
        {"id": 2, "name": "Mouse"},
        {"id": 3, "name": "Keyboard"}
    ]

# Run with: uvicorn main:app --reload
# Access at / and /items

Endpoint Naming Conventions

Good endpoint naming keeps an API readable: plural nouns for collections, short lowercase hyphenated paths, and no verbs — the HTTP method implies the action.

Quick Check

Which of the following code snippets correctly defines a FastAPI GET endpoint at the path /status that returns a JSON object {"status": "OK"}?

Lesson Summary

Solid! You built endpoints with decorators, returned dicts as JSON, and ran the app via Uvicorn. Next: making routes dynamic with URL data.

자주 묻는 질문

“첫 API 엔드포인트” 강의는 무료인가요?

네 — “첫 API 엔드포인트” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 FastAPI Backend Development Bootcamp 강의 전체를 잠금 해제할 수 있습니다. FastAPI Backend Development Bootcamp 강의에는 총 4개의 강의가 포함되어 있습니다.

“첫 API 엔드포인트”에서 뭘 배우나요?

간단한 GET 엔드포인트를 만들고 경로를 정의하며 기본 JSON 응답을 반환하는 방법을 배웁니다. 브라우저에서 직접 실행하는 실습 코드로 FastAPI Backend Development Bootcamp을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

FastAPI Backend Development Bootcamp을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 FastAPI Backend Development Bootcamp은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“첫 API 엔드포인트” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 FastAPI Backend Development Bootcamp 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 FastAPI Backend Development Bootcamp 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. FastAPI 소개 및 설정
  2. 첫 API 엔드포인트
  3. 경로 및 쿼리 매개변수
  4. Swagger UI를 활용한 대화형 API 문서
← FastAPI Backend Development Bootcamp(으)로 돌아가기