KKBOX API Flask CORS for handling Cross Origin Resource Sharing, making cross-origin AJAX possible.
This is a simple demo at https://kk-search.herokuapp.com/search?q=Mayday&type=track&territory=TW.
Demo only provide search api.
- Change
setting.cfg
value
CLIENT_ID='<CLIENT_ID>'
CLIENT_SECRET='<CLIENT_SECRET>'
ALLOW_CORS_DOMAIN='http://example.com'
- Set environment variable
export CLIENT_ID='<CLIENT_ID>'
export CLIENT_SECRET='<CLIENT_SECRET>'
export ALLOW_CORS_DOMAIN='http://example.com'
- Set environment variable before run server command
CLIENT_ID='<CLIENT_ID>' CLEINT_SECRET='<CLIENT_SECRET>' ALLOW_CORS_DOMAIN='http://example.com' python server.py
- Simple run server
python server.py
- Use gunicorn run server
# default address:port = 0.0.0.0:8000
gunicorn kkbox_api:app
# specify address:port
gunicorn kkbox_api:app -b 127.0.0.1:6666
- Deploy to HeroKu