# Starting FastAPI

* To start a FastAPI  app you will need to set up first a path operation

```python
# Import FastAPI framework
from fastapi import FastAPI

# Set up the App
app = FastAPI()

# Set up the path operation
@app.get("/")
async def root():
    return {"message": "Hello World"}
```

* Then you will have to run the <mark style="color:green;">uvicorn webserver</mark> by using the file name followed by the app name in said file

```python
uvicorn main:app

# If you get an error that uvicorn is not valid use:
python -m uvicorn main:app --reload
```

* This should return the information that the browser is running on local host

```bash
INFO:     Started server process [21240]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```

* Now you can access the API in the browser and see the message

![](/files/YOu95B8WJxx2sZtNjyPa)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arkannis.net/programming/python/frameworks/fastapi/starting-fastapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
