mirror of
https://github.com/thatmattlove/hyperglass.git
synced 2026-01-17 08:48:05 +00:00
Add GZIP support & swap Starlette classes for FastAPI classes
This commit is contained in:
parent
a89d08ba58
commit
fb003f3248
1 changed files with 7 additions and 3 deletions
|
|
@ -7,12 +7,13 @@ from pathlib import Path
|
|||
|
||||
# Third Party
|
||||
from fastapi import FastAPI
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.exceptions import ValidationError, RequestValidationError
|
||||
from starlette.responses import JSONResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||
from fastapi.openapi.utils import get_openapi
|
||||
from starlette.staticfiles import StaticFiles
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.middleware.gzip import GZipMiddleware
|
||||
|
||||
# Project
|
||||
from hyperglass.log import log
|
||||
|
|
@ -184,6 +185,9 @@ app.add_middleware(
|
|||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# GZIP Middleware
|
||||
app.add_middleware(GZipMiddleware)
|
||||
|
||||
app.add_api_route(
|
||||
path="/api/info",
|
||||
endpoint=info,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue