Add optional skip and limit to API route

This commit is contained in:
2021-01-18 03:59:21 +00:00
parent 3ff917e806
commit 6f64401785
2 changed files with 5 additions and 2 deletions

View File

@@ -42,7 +42,9 @@ cors = CORS(flask_app)
@flask_app.route('/api')
def api():
stories = database.get_stories(FEED_LENGTH)
skip = request.args.get('skip', 0)
limit = request.args.get('limit', FEED_LENGTH)
stories = database.get_stories(limit, skip)
# hacky nested json
res = Response('{"stories":[' + ','.join(stories) + ']}')
res.headers['content-type'] = 'application/json'