diff --git a/app.py b/app.py index 4535f74..0819ea8 100644 --- a/app.py +++ b/app.py @@ -2,6 +2,7 @@ from typing import Dict, List, Tuple from fastapi import FastAPI, HTTPException +from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from GoogleNews import GoogleNews @@ -10,6 +11,17 @@ googlenews = GoogleNews(lang='en', period="7d", encode='utf-8') +app.add_middleware( + CORSMiddleware, + allow_origins=[ + "http://localhost:5500", # TODO: This has to leave after testing + "https://igormcsouza.github.io"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + + class RequestBody(BaseModel): topic: str