Skip to content
Snippets Groups Projects
Commit 075f04ac authored by Sastry, Nishanth Prof (Comp Sci & Elec Eng)'s avatar Sastry, Nishanth Prof (Comp Sci & Elec Eng)
Browse files

remove dependence on services and nice_json

parent 89367ade
No related branches found
No related tags found
No related merge requests found
......@@ -10,13 +10,14 @@ with open("{}/database/movies.json".format(os.getcwd()), "r") as f:
@app.route("/", methods=['GET'])
def hello():
return nice_json({
endpoints = {
"uri": "/",
"subresource_uris": {
"movies": "/movies",
"movie": "/movies/<id>"
}
})
}
return json.dumps(endpoints)
@app.route("/movies/<movieid>", methods=['GET'])
def movie_info(movieid):
......
......
from services import root_dir, nice_json
from flask import Flask
from werkzeug.exceptions import NotFound
import json
......@@ -16,18 +15,19 @@ with open(showtimes_db, "r") as f:
@app.route("/", methods=['GET'])
def hello():
return nice_json({
endpoints = {
"uri": "/",
"subresource_uris": {
"showtimes": "/showtimes",
"showtime": "/showtimes/<date>"
}
})
}
return json.dumps(endpoints)
@app.route("/showtimes", methods=['GET'])
def showtimes_list():
nice_json(showtimes)
return json.dumps(showtimes)
@app.route("/showtimes/<date>", methods=['GET'])
......@@ -39,7 +39,7 @@ def showtimes_record(date):
for movie_id in showtimes[date]:
resp = requests.get(movies_service.format(movie_id))
result.append(resp.json()["title"])
return nice_json(result)
return json.dumps(result)
if __name__ == "__main__":
app.run(port=5002, debug=True)
app.run(host="0.0.0.0",port=5002, debug=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment