Skip to content
Snippets Groups Projects
Commit 6ade0d08 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Merge branch 'develop' into feature/COMP-152-EC-PROJECTS-TABLE

parents d29aa29a f2ae0a7b
Branches
Tags
1 merge request!11merge feature/COMP-152-EC-PROJECTS-TABLE into develop
......@@ -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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment