Spaces:
Running
Running
File size: 750 Bytes
877add7 | 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 | """API application entrypoint."""
from __future__ import annotations
import os
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.routes import router
app = FastAPI(title="POLYGUARD-RL API", version="0.1.0")
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://127.0.0.1:5173",
"http://localhost:5173",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(router)
def main() -> None:
host = os.getenv("POLYGUARD_API_HOST", "127.0.0.1")
port = int(os.getenv("POLYGUARD_API_PORT", "8200"))
uvicorn.run("app.api:app", host=host, port=port, reload=False)
if __name__ == "__main__":
main()
|