Skip to content
Snippets Groups Projects

merge feature/COMP-152-EC-PROJECTS-TABLE into develop

Merged Bjarke Madsen requested to merge feature/COMP-152-EC-PROJECTS-TABLE into develop
2 unresolved threads
1 file
+ 8
1
Compare changes
  • Side-by-side
  • Inline
@@ -11,7 +11,7 @@ Default Endpoints
"""
import pkg_resources
from flask import Blueprint, jsonify, render_template
from flask import Blueprint, jsonify, render_template, Response
from compendium_v2.routes import common
@@ -45,6 +45,13 @@ def after_request(resp):
@routes.route('/', defaults={'path': ''}, methods=['GET'])
@routes.route('/<path:path>', methods=['GET'])
def index(path):
is_api = path.startswith('api')
if is_api:
# return 404 for API requests that don't match a route
return Response(status=404, mimetype='application/json', response='{"error": "Not Found"}')
# fallback to serving the SPA through index.html for all other requests
# https://flask.palletsprojects.com/en/2.0.x/patterns/singlepageapplications/
return render_template('index.html')
Loading