diff --git a/api.py b/api.py index 7931079..4df8e93 100644 --- a/api.py +++ b/api.py @@ -68,6 +68,23 @@ def save(): else: return '{"status": "error access code"}', 403 +@app.route('/shared/', methods=['GET']) +def shared(uid): + with sqlite3.connect('data.db') as conn: + sql = "SELECT `json` FROM `courseTables` WHERE `uid`=?" + + data = conn.execute(sql, [uid]).fetchone() + + if data: + ansJSON = data[0] + return json.dumps({ + "status": "ok", + "data": ansJSON + }), 200 + else: + return json.dumps({ + "status": "not found", + }), 404 if __name__ == '__main__': app.debug = True app.run(host='0.0.0.0') diff --git a/index.html b/index.html index b1bfc7f..2fc59e7 100644 --- a/index.html +++ b/index.html @@ -45,6 +45,7 @@ +