summaryrefslogtreecommitdiff
path: root/python/routes.py
blob: 9567318b3d2e4a0df38ca9cfc544da07ccdbd09e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from flask import Flask, jsonify, request
import database


app = Flask(__name__)


def run():
    app.run()


@app.route("/", methods=['GET'])
def hello_world():
    return "not here"


@app.route("/song", methods=['GET'])
def get_song():
    id = request.args.get('id')
    name = request.args.get('name')
    return jsonify(database.get_song(id=id, name=name))


@app.route("/songs", methods=['GET'])
def get_filtered_songs():
    song = request.args.get('song')
    album = request.args.get('album')
    artist = request.args.get('artist')
    return jsonify(
        database.get_filtered_songs(
            song=song, album=album, artist=artist
        )
    )