Skip to content
Snippets Groups Projects

Added middleware

Merged Ask Markestad requested to merge test-alternative-endpoint into master
1 file
+ 10
0
Compare changes
  • Side-by-side
  • Inline
+ 10
0
@@ -3,6 +3,7 @@ import asyncio
from fastapi import FastAPI
from langserve import add_routes
from fastapi.middleware.cors import CORSMiddleware
if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
@@ -15,6 +16,15 @@ app = FastAPI(
description="Spin up a simple api server using Langchain's Runnable interfaces",
)
# Set all CORS enabled origins
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
expose_headers=["*"],
)
@app.get("/")
async def root():
Loading