-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwsgi.py
51 lines (39 loc) · 917 Bytes
/
wsgi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from fastapi import FastAPI
from api import router
from fastapi.middleware.cors import CORSMiddleware
def make_middleware(app: FastAPI):
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)
def init_routers(app: FastAPI) -> None:
"""
Initialize routers for the application.
Parameters
----------
app : FastAPI
The FastAPI instance to attach the routers to.
Returns
-------
None
"""
app.include_router(router)
def create_app() -> FastAPI:
"""
Create the FastAPI application.
Returns
-------
app : FastAPI
The FastAPI instance.
"""
app = FastAPI(
title="Preprocessing Micro Service",
version="0.1.2",
)
init_routers(app)
make_middleware(app)
return app
app = create_app()