Skip to content

Commit

Permalink
specify mimetype
Browse files Browse the repository at this point in the history
  • Loading branch information
ddPn08 committed Feb 11, 2023
1 parent 262d9c6 commit 59fbd01
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import tensorrt
import importlib
import os
import mimetypes

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
Expand All @@ -12,11 +13,9 @@
from .frontend import frontend
from .shared import ROOT_DIR


def custom_generate_unique_id(route: APIRoute):
return route.name


app = FastAPI(generate_unique_id_function=custom_generate_unique_id)
allowed_hosts = config.get("allow_hosts")
app.add_middleware(
Expand All @@ -26,6 +25,8 @@ def custom_generate_unique_id(route: APIRoute):
allow_methods=["*"],
allow_headers=["*"],
)
mimetypes.init()
mimetypes.add_type("application/javascript", ".js")

app.include_router(api)
app.include_router(frontend)
Expand Down

0 comments on commit 59fbd01

Please sign in to comment.