From 002b1c52d385cb44ea76883047376b861f31f650 Mon Sep 17 00:00:00 2001 From: Thomas Roiseux Date: Sun, 17 Dec 2023 11:32:12 +0100 Subject: [PATCH] Added endpoints --- Dockerfile | 2 ++ core/__main__.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index 7034332..3f3efca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,8 @@ RUN pip install -r requirements.txt COPY . . +VOLUME [ "/var/log" ] + EXPOSE 5000/tcp CMD ["python", "core/__main__.py"] \ No newline at end of file diff --git a/core/__main__.py b/core/__main__.py index 7d48780..af03ca1 100644 --- a/core/__main__.py +++ b/core/__main__.py @@ -5,6 +5,12 @@ app = Flask(__name__) +@app.route('/', methods=['GET']) +def index(): + logging.info('Request received from %s', request.remote_addr) + logging.info("Sending index page") + return jsonify({'message': 'To get your IP, send a GET request to /ip'}) + @app.route('/ip', methods=['GET']) def get_public_ip(): try: