Skip to content

Commit

Permalink
Merge pull request #5 from igormcsouza/hotfix/allow-cors
Browse files Browse the repository at this point in the history
Hotfix/allow cors
  • Loading branch information
igormcsouza authored Sep 11, 2021
2 parents 2277458 + 4f65b97 commit b6457b3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit b6457b3

Please sign in to comment.