diff --git a/server/app.py b/server/app.py index 2c6a444..f775559 100644 --- a/server/app.py +++ b/server/app.py @@ -1,12 +1,17 @@ from flask import Flask from db.database import Database +from connectors.reddit_connector import RedditConnector app = Flask(__name__) db = Database(db_name='ethnograph', user='ethnograph_user', password='ethnograph_pass') -@app.route('/') -def index(): - return "Welcome to the Ethnograph View Server!" +reddit_connector = RedditConnector() + +@app.route('/get_reddit_posts//', methods=['GET']) +def index(search, limit = 10): + posts = reddit_connector.search_posts(search, limit=limit) + return {"posts": [post.__dict__ for post in posts]} + if __name__ == "__main__": app.run(debug=True) \ No newline at end of file