|
@@ -11,7 +11,7 @@ GET_WORLD = "select randomnumber from world where id = $1"
|
|
|
UPDATE_WORLD = "update world set randomNumber = $2 where id = $1"
|
|
|
|
|
|
|
|
|
[email protected]_first_request
|
|
|
[email protected]_serving
|
|
|
async def connect_to_db():
|
|
|
app.db = await asyncpg.create_pool(
|
|
|
user=os.getenv("PGUSER", "benchmarkdbuser"),
|
|
@@ -22,9 +22,14 @@ async def connect_to_db():
|
|
|
)
|
|
|
|
|
|
|
|
|
[email protected]_serving
|
|
|
+async def disconnect_from_db():
|
|
|
+ await app.db.close()
|
|
|
+
|
|
|
+
|
|
|
@app.route("/json")
|
|
|
-def json():
|
|
|
- return jsonify(message="Hello, World!")
|
|
|
+async def json():
|
|
|
+ return {"message": "Hello, World!"}
|
|
|
|
|
|
|
|
|
@app.route("/plaintext")
|