2022-01-19 08:40:02 +08:00
|
|
|
from fastapi import FastAPI
|
|
|
|
from starlette.responses import HTMLResponse
|
|
|
|
|
|
|
|
|
2023-04-08 14:48:01 +08:00
|
|
|
def setup_backends(app: FastAPI, serve_webapp: bool):
|
|
|
|
backends = "/backends" if serve_webapp else "/"
|
|
|
|
|
|
|
|
@app.get(backends, response_class=HTMLResponse)
|
2022-01-19 08:40:02 +08:00
|
|
|
def index():
|
|
|
|
return """
|
|
|
|
<!Doctype html>
|
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<h1>SecureAPI</h1>
|
|
|
|
<div class="btn-group">
|
|
|
|
<a href="/docs"><button>SwaggerUI</button></a>
|
|
|
|
<a href="/redoc"><button>Redoc</button></a>
|
2022-11-20 21:20:41 +08:00
|
|
|
<a href="/felicity-gql"><button>Felicity GraphQL</button></a>
|
2022-01-19 08:40:02 +08:00
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
"""
|