Created
May 7, 2019 16:11
-
-
Save simonw/7027cdc1f7df3821c88da13314cce277 to your computer and use it in GitHub Desktop.
Source code for https://now-2-asgi-hello-world.now.sh/ which uses https://github.com/gbozee/now-python-asgi
This file contains 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
# 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