Project 1 - FastAPI Request Method Logic : Swagger UI 사용법

이한솔(Hansol Lee)·2023년 3월 11일
0

FastAPI

목록 보기
5/6
from fastapi import FastAPI

app = FastAPI()

BOOKS = {
    'book_1' : {'title' : 'Title One', 'author' : 'Autor One'},
    'book_2' : {'title' : 'Title Two', 'author': 'Autor Two'},
    'book_3' : {'title' : 'Title Three', 'author': 'Autor Three'},
    'book_4' : {'title' : 'Title Four', 'author': 'Autor Four'},
    'book_5' : {'title' : 'Title Five', 'author': 'Autor Five'},
}

@app.get('/')
async def raad_all_books() 

까지 하고 terminal에

uvicorn books:app --reload

친 후 엔터를 누르면
local URL에 뜬다. (127.0.0.1:8000)

들어가서
주소창에

http://127.0.0.1:8000/docs

라고 치고 엔터를 누르면
Fast API Swagger UI 가 나타난다!

이렇게 비슷하게 나타날 것임!

profile
데이터사이언티스트를 꿈꾸는 사회초년생

0개의 댓글