Last active
August 1, 2025 07:30
-
-
Save pydanny/8305dea54c19504b08765ac53209a50a to your computer and use it in GitHub Desktop.
Air+FastAPI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dependency: air and "fastapi[standard]"" | |
# | |
import air | |
from fastapi import FastAPI | |
app = air.Air() | |
api = FastAPI() | |
@app.page | |
def index(): | |
return air.layouts.mvpcss( | |
air.Title('Hello, Manila'), | |
air.H1('Hello, Manila'), | |
air.Article( | |
air.P('I love Python, Audrey, and Uma.'), | |
air.P( | |
air.A('/api', href='/api'), | |
), | |
air.P( | |
air.A('/api/docs', href='/api/docs'), | |
) | |
) | |
) | |
@api.get('/') | |
def root(): | |
return dict(root='I am the root of the project') | |
app.mount('/api', api, name='api') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment