feat: Add initial client and server templates for FastAPI tutorial.

This commit is contained in:
2026-02-28 12:45:54 +09:00
parent 0966bd9a61
commit 8c0819feea
2 changed files with 85 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
from fastapi import FastAPI, Query
from pydantic import BaseModel
from datetime import datetime
from typing import List
app = FastAPI()
# 메시지 저장을 위한 리스트
messages = []
class Message(BaseModel):
name: str
message: str
@app.post("/messages")
def post_message(msg: Message):
@app.get("/messages")
def get_messages(start: int = 0):
if __name__ == "__main__":
import uvicorn
# 터미널에서 직접 실행할 때를 위해 uvicorn 설정 추가
uvicorn.run(app, host="0.0.0.0", port=8000)