Trying to test my first FastAPI application using uvicorn.
The following code was written on Jupyter Notebook and saved as 'main.py'
in the directory: /home/user
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
From the same directory I am running:
$uvicorn main --reload
It throws the following error:
ERROR: Error loading ASGI app. Import string "main" must be in format ":".