Coverage for docs_src/wsgi/tutorial001.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-08 03:53 +0000
1from fastapi import FastAPI 1abcde
2from fastapi.middleware.wsgi import WSGIMiddleware 1abcde
3from flask import Flask, request 1abcde
4from markupsafe import escape 1abcde
6flask_app = Flask(__name__) 1abcde
9@flask_app.route("/") 1abcde
10def flask_main(): 1abcde
11 name = request.args.get("name", "World") 1abcde
12 return f"Hello, {escape(name)} from Flask!" 1abcde
15app = FastAPI() 1abcde
18@app.get("/v2") 1abcde
19def read_main(): 1abcde
20 return {"message": "Hello World"} 1abcde
23app.mount("/v1", WSGIMiddleware(flask_app)) 1abcde