diff --git a/api/api.py b/api/api.py index f77e7fc..dbadc9a 100644 --- a/api/api.py +++ b/api/api.py @@ -1,6 +1,10 @@ from flask import Flask from flask_restful import Api, Resource import ECNQueue +import os, dotenv + +# Load envrionment variables for ./.env +dotenv.load_dotenv() # Create Flask App app = Flask(__name__) @@ -8,8 +12,6 @@ # Create API Interface api = Api(app) - - class Item(Resource): def get(self, queue: str, number: int) -> str: """Returns the JSON representation of the item requested. @@ -80,12 +82,9 @@ def get(self) -> list: list: Dictionaries with the number of items in each queue. """ return ECNQueue.getQueueCounts() - -api.add_resource(QueueList, "/api/get_queues") -api.add_resource(Item, "/api//") -api.add_resource(Queue, "/api/") -if __name__ == "__main__": - app.run() +api.add_resource(QueueList, "/api/get_queues") +api.add_resource(Item, "/api//") +api.add_resource(Queue, "/api/") \ No newline at end of file