Skip to content

Instantly share code, notes, and snippets.

@pydanny
Last active August 1, 2025 07:30
Show Gist options
  • Save pydanny/8305dea54c19504b08765ac53209a50a to your computer and use it in GitHub Desktop.
Save pydanny/8305dea54c19504b08765ac53209a50a to your computer and use it in GitHub Desktop.
Air+FastAPI
# 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