vumichien commited on
Commit
4e4ac38
·
1 Parent(s): 8c524cd

add middleware

Browse files
Files changed (1) hide show
  1. main.py +14 -1
main.py CHANGED
@@ -4,6 +4,7 @@ from fastapi import FastAPI
4
  import uvicorn
5
  import traceback
6
  from contextlib import asynccontextmanager
 
7
 
8
  current_dir = os.path.dirname(os.path.abspath(__file__))
9
  sys.path.append(current_dir)
@@ -34,6 +35,9 @@ app = FastAPI(
34
  description="API for MeisaiCheck AI System",
35
  version="1.0",
36
  lifespan=lifespan,
 
 
 
37
  openapi_tags=[
38
  {
39
  "name": "Health",
@@ -50,9 +54,18 @@ app = FastAPI(
50
  ],
51
  )
52
 
 
 
 
 
 
 
 
 
 
53
  # Include Routers
54
  app.include_router(health.router, tags=["Health"])
55
- app.include_router(auth.router, tags=["Authentication"], prefix="")
56
  app.include_router(predict.router, tags=["AI Model"])
57
 
58
 
 
4
  import uvicorn
5
  import traceback
6
  from contextlib import asynccontextmanager
7
+ from fastapi.middleware.cors import CORSMiddleware
8
 
9
  current_dir = os.path.dirname(os.path.abspath(__file__))
10
  sys.path.append(current_dir)
 
35
  description="API for MeisaiCheck AI System",
36
  version="1.0",
37
  lifespan=lifespan,
38
+ openapi_url="/openapi.json",
39
+ docs_url="/docs",
40
+ redoc_url="/redoc",
41
  openapi_tags=[
42
  {
43
  "name": "Health",
 
54
  ],
55
  )
56
 
57
+ # Add CORS middleware
58
+ app.add_middleware(
59
+ CORSMiddleware,
60
+ allow_origins=["*"],
61
+ allow_credentials=True,
62
+ allow_methods=["*"],
63
+ allow_headers=["*"],
64
+ )
65
+
66
  # Include Routers
67
  app.include_router(health.router, tags=["Health"])
68
+ app.include_router(auth.router, tags=["Authentication"])
69
  app.include_router(predict.router, tags=["AI Model"])
70
 
71