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
3. 【python】6 projectss for beginners learning python
留言列表
