close

 

Create a new environment for the project in Anaconda

2. pip install fastapi

3. pip install uvicorn

edit a python program and name it as "main.py"

 

 

 

Start the program by uvicorn

uvicorn main:app --host 0.0.0.0 --port 8087

 

We are able to check out if the service works correctly in a web browser

 

Here, we use postman, which is a famous testing tool, to send a request

 

  Input item_id =1 and q = book  

  The server responded with item_id =1 and q ='書本'

 

 

  Input item_id =2 and q = program

  The server responded with item_id =2 and q ='程式'

 

 

  Input item_id =3 and q = apple

  The server responded with item_id =3 and q ='蘋果'

 

 Reference: 

1. FastAPI

2. [day8]FASTAPI建置示範-進度落後了!!

3. 【python】6 projectss for beginners learning python

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 me1237guy 的頭像
    me1237guy

    天天向上

    me1237guy 發表在 痞客邦 留言(0) 人氣()