Skip to content

Commit

Permalink
fix: cors
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfromyeg committed Jun 18, 2023
1 parent 69dddba commit d7003db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
- [ ] `CONTRIBUTING.md`
- [ ] `CHANGELOG.md`
- [ ] Remove "whoami" step from `deploy.yml`
- [ ] Better CORS in server
9 changes: 7 additions & 2 deletions server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@

import json
import re
import os

import lyricsgenius
from flask import Flask, jsonify, request
from flask_cors import CORS
from dotenv import load_dotenv

from song import Song

app = Flask("__main__")
app = Flask(__name__)
CORS(app)

load_dotenv()

IS_DEVELOPMENT = os.getenv("PYTHON_ENV") == "development"


@app.route("/lyrics/<artist>/<song_name>", methods=["GET"])
def get_lyrics(artist, song_name):
Expand Down Expand Up @@ -42,4 +47,4 @@ def find_rhymes():
return json.dumps(song_instance.find_all_rhyme_clusters())


app.run(debug=True)
app.run(debug=IS_DEVELOPMENT)
2 changes: 2 additions & 0 deletions server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ charset-normalizer==3.1.0
click==8.1.3
dill==0.3.6
Flask==2.3.2
Flask-Cors==3.0.10
idna==3.4
isort==5.12.0
itsdangerous==2.1.2
Expand All @@ -24,6 +25,7 @@ pylint==2.17.4
python-datamuse==2.0.1
python-dotenv==1.0.0
requests==2.31.0
six==1.16.0
soupsieve==2.4.1
tomli==2.0.1
tomlkit==0.11.8
Expand Down

0 comments on commit d7003db

Please sign in to comment.