Skip to content

Instantly share code, notes, and snippets.

@simonw
Created May 7, 2019 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonw/7027cdc1f7df3821c88da13314cce277 to your computer and use it in GitHub Desktop.
Save simonw/7027cdc1f7df3821c88da13314cce277 to your computer and use it in GitHub Desktop.
# For a sample Starlette app
from starlette.applications import Starlette
from starlette.responses import JSONResponse
import sys
import sqlite3
application = Starlette()
@application.route("/")
async def homepage(request):
return JSONResponse(
{
"hello": "world",
"python_version": sys.version,
"sqlite_version": sqlite3.connect(":memory:")
.execute("select sqlite_version()")
.fetchall(),
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment