diff --git a/app/routes/roll_dice.py b/app/routes/roll_dice.py index 27b1aa8..8145354 100644 --- a/app/routes/roll_dice.py +++ b/app/routes/roll_dice.py @@ -15,7 +15,7 @@ parser.add_argument('geometry', type=int, required=True, help='Number of faces o parser.add_argument('discard_lowest', type=str_to_bool, required=True, help='Whether to discard lowest roll') -@namespace.route('') # resolves to: /dice +@namespace.route('/') # resolves to: /dice or /dice/ class RollDice(Resource): @namespace.expect(parser) def get(self): diff --git a/tests/test_routes/test_route_dice.py b/tests/test_routes/test_route_dice.py index ca2928c..e35c48a 100644 --- a/tests/test_routes/test_route_dice.py +++ b/tests/test_routes/test_route_dice.py @@ -1,7 +1,7 @@ import pytest from app import app -ROUTE = '/dice' +ROUTE = '/dice/' @pytest.fixture diff --git a/web/rolldice.js b/web/rolldice.js index 676ac56..a649930 100644 --- a/web/rolldice.js +++ b/web/rolldice.js @@ -12,7 +12,10 @@ window.onload = function () { discard_lowest: discard }); - fetch(`${window.BASE_URL}/dice?${queryParams}`) + const urlToFetch = `${window.BASE_URL}/dice?${queryParams}`; + console.log(`URL to fetch: ${urlToFetch}`); + + fetch(urlToFetch) .then(response => response.json()) .then(data => { const resultsDiv = document.getElementById('results');