Path Parameters1 [Big data & Python] FastAPI, Path Parameters, query(get), post(Request Body), Pydantic, Annotated 1. FastAPI - 01 (FastAPI란?) 이론 링크: https://just-record.github.io/fastapi/fastapi-01/ from fastapi import FastAPI app = FastAPI() # FastAPI의 인스턴스 객체 app를 생성. @app.get("/") # 경로 동작 데코레이터 (url 주소) async def root(): # 경로 동작 함수 return {"message": "Hello World"} # json Type으로 return 저번 시간에 사용했던 Flask랑 사용법이 비슷하다.(같은 웹 호스팅 모듈이라 그런 것 같다) cmd창에 curl -X GET \ http://localhost:8000/ 를 입력하면 호스팅한 값을 콘솔창에 띄운다... Coding 공부/Big data & Python 2024. 4. 15. 이전 1 다음 728x90 반응형