Uvicorn doesn't give error but doesn't show anything on the browser

27 Views Asked by At

I am running the following script:

from typing import Union

from fastapi import FastAPI

app = FastAPI()

@app.get("")

def read_root():

return {"Hello": "World"}

@app.get("/items/{item_id}")

def read_item(item_id: int, q: Union[str, None] = None):

return {"item_id": item_id, "q": q}

and on command line

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

it is saying "?[32mINFO?[0m: Uvicorn running on ?[1mhttp://0.0.0.0:8080?[0m (Press CTRL+C to quit) "

however, when I go to the browser, it doesn't show anything saying "This site can’t be reached".

I've tried with different ports as well. Any suggestions?

Thank you

Bes

tried with different ports and the same thing happened

0

There are 0 best solutions below