mirror of
https://github.com/fastapi/fastapi.git
synced 2025-12-30 09:39:20 -05:00
* 🏁 Fix ./scripts/docs.py encoding for Windows * 🔥 Remove ujson from tests as it prevents Windows development It's still tested by Starlette anyway * 📝 Update development instructions for Windows * 🎨 Update format for WSGIMiddleware example * ✅ Update tests to run on Windows
23 lines
421 B
Python
23 lines
421 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.wsgi import WSGIMiddleware
|
|
from flask import Flask, escape, request
|
|
|
|
flask_app = Flask(__name__)
|
|
|
|
|
|
@flask_app.route("/")
|
|
def flask_main():
|
|
name = request.args.get("name", "World")
|
|
return f"Hello, {escape(name)} from Flask!"
|
|
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/v2")
|
|
def read_main():
|
|
return {"message": "Hello World"}
|
|
|
|
|
|
app.mount("/v1", WSGIMiddleware(flask_app))
|