[+] New blueprint method

[+] Allows subdomain filtering for routes
[+] Allows routes scalability

Signed-off-by: Charles Le Maux <charles.le-maux@epitech.eu>
This commit is contained in:
Charles Le Maux 2024-06-29 17:41:27 +01:00
parent 166ab2f198
commit fe51740ce0

4
app.py
View File

@ -10,7 +10,7 @@ import generic_executor
app = Flask(__name__)
CORS(app)
cors = CORS(app, origins=['*'])
apiBP = Blueprint('api', 'api', subdomain="api")
apiBP = Blueprint('apiBP', 'BPapi', subdomain="api")
def generic_response_maker(status_code: http.HTTPStatus, _message: str = None) -> tuple[Response, int]:
@ -114,6 +114,6 @@ def dynamic_route_handler(path):
if __name__ == '__main__':
ssl_context = ('/secrets/fullchain.pem', '/secrets/privkey.pem')
ssl_context = ('./secrets/fullchain.pem', './secrets/privkey.pem')
app.register_blueprint(apiBP)
app.run(host='0.0.0.0', port=3000, debug=False, ssl_context=ssl_context)