시프트원은 Python Web Framework 로 FastAPI 를 사용합니다.

FastAPI

설치 가이드

요구사항

설치

$ pip install fastapi

프로덕션을 위해 Uvicorn 또는 Hypercorn 과 같은 ASGI 서버가 필요합니다. 시프트원은 Uvicorn 을 사용합니다.

$ pip install uvicorn[standard]

만들기

from typing import Optional
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def read_root():
		return { "Hello" : "World" }

@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Optional[str] = None):
		return { "item_id" : item_id, "q" : q }