Write a Python program that listens to localhost:8000
and responds
with the json { "hello": "world" }
to a get
request directed at the
root endpoint located at /
.
pip install fastapi uvicorn
uvicorn main:app
http localhost:8000 # using httpie in debian
Should return header and body similar to:
HTTP/1.1 200 OK
content-length: 17
content-type: application/json
date: Fri, 14 Feb 2024 05:29:06 GMT
server: uvicorn
{
"hello": "world"
}