Skip to content

Commit 9e20ea0

Browse files
authored
Merge pull request #331 from osmith42/api-service-redirect
services/apiService: redirect from / to /docs
2 parents 1b735cb + 8cf1328 commit 9e20ea0

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

services/apiService.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# SPDX-License-Identifier: AGPL-3.0-or-later
88
import sys
99
import json
10-
from flask import Flask, request, jsonify, Response
10+
from flask import Flask, request, jsonify, Response, redirect
1111
from flask_restx import Api, Resource, fields, reqparse, abort
1212
from werkzeug.middleware.proxy_fix import ProxyFix
1313
from functools import wraps
@@ -63,6 +63,10 @@
6363

6464
apiService = Flask(__name__)
6565

66+
@apiService.route("/")
67+
def PyHSS_API_redirect_to_docs():
68+
return redirect("/docs/")
69+
6670
APN = database.APN
6771
Serving_APN = database.SERVING_APN
6872
AUC = database.AUC
@@ -258,7 +262,12 @@ def decorated_function(*args, **kwargs):
258262
return decorated_function
259263

260264
def auth_before_request():
261-
if request.path.startswith('/docs') or request.path.startswith('/swagger') or request.path.startswith('/metrics'):
265+
if (
266+
request.path.startswith("/docs")
267+
or request.path.startswith("/swagger")
268+
or request.path.startswith("/metrics")
269+
or request.path == "/"
270+
):
262271
return None
263272
if request.method == "OPTIONS":
264273
res = Response()

0 commit comments

Comments
 (0)