aliSaac510 commited on
Commit
baf94f2
·
verified ·
1 Parent(s): f773d68

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -6
main.py CHANGED
@@ -1,12 +1,12 @@
1
  import os
2
- from flask import Flask, send_file, request, jsonify
3
  from scraper import scrape_books_by_level, scrape_book_content
4
 
5
  app = Flask(__name__)
6
 
7
  @app.route("/")
8
  def index():
9
- return send_file('src/index.html')
10
 
11
  @app.route("/api/books", methods=['GET'])
12
  def api_books():
@@ -35,8 +35,9 @@ def api_book_content():
35
 
36
  return jsonify({"data": content})
37
 
38
- def main():
39
- app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
 
40
 
41
- if __name__ == "__main__":
42
- main()
 
1
  import os
2
+ from flask import Flask, request, jsonify
3
  from scraper import scrape_books_by_level, scrape_book_content
4
 
5
  app = Flask(__name__)
6
 
7
  @app.route("/")
8
  def index():
9
+ return jsonify({"message": "API is running. Use /api/books to get book data."})
10
 
11
  @app.route("/api/books", methods=['GET'])
12
  def api_books():
 
35
 
36
  return jsonify({"data": content})
37
 
38
+ # The following code is no longer needed as gunicorn is used to run the app
39
+ # def main():
40
+ # app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
41
 
42
+ # if __name__ == "__main__":
43
+ # main()