FastAPI | Cookbook

Einleitung

Anforderungen

Inhaltsverzeichnis

CORS

app = FastAPI()
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"]
)

Starlette

Templates

Template erstellen

...

    
...

Template verwenden



    ...
    <main>....</main>




Links

CSS

<link href="{{ url_for('static', path='/css/bootstrap.min.css') }}"
      rel="stylesheet"
>

JavaScript

<script src="{{ url_for('static', path='/js/jquery.min.js') }}"></script>