from flask import Flask, Response
from analysis import showCuisines, loadData
import json

data = loadData()
app = Flask(__name__, static_url_path='', static_folder='.')
app.add_url_rule('/', 'root', lambda: app.send_static_file('index.html'))

@app.route('/vis/<zipCode>')
def makeVis(zipCode):

    output = showCuisines(loadData(), zipCode).to_json()

    return Response(output,
        mimetype='application/json',
        headers={
            'Cache-Control': 'no-cache',
            'Access-Control-Allow-Origin': '*'
            }
        )

if __name__ == '__main__':
    app.run(port=80)
