Last active
May 25, 2019 03:30
-
-
Save elseagle/bed782e2d28a61d9fc8870b89548fbe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/item') | |
def get(): | |
connection = sqlite3.connect('data.db') | |
cursor = connection.cursor() | |
query = "SELECT * FROM items" | |
result = cursor.execute(query) | |
items = [] | |
for row in result: | |
items.append({'name': row[0], 'price': row[1]}) | |
connection.close() | |
return jsonify({'items': items}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment