I'm trying (failing) to set up a simple FastAPI project and run it with uvicorn. This is my code:
from fastapi import FastAPI
app = FastAPI()
app.get('/')
def hello_world():
return{'hello':'world'}
app.get('/abc')
def abc_test():
return{'hello':'abc'}
This is what I run from the terminal:
PS C:\Users\admin\Desktop\Self pace study\Python\Dev\day 14> uvicorn server2:app
INFO: Started server process [3808]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: 127.0.0.1:60391 - "GET / HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:60391 - "GET /favicon.ico HTTP/1.1" 404 Not Found
As you see, I get a 404 Not found. What could be the reason? Some network-related stuff, possibly firewall/vpn blocking this connection or something else? I'm new to this. Thanks in advance!
@app.get(...)
, not justapp.get()
– JPG