Commit bfd808a6 authored by Jaden DIEFENBAUGH's avatar Jaden DIEFENBAUGH
Browse files

[server] serve static files & redirect "/" to "index.html"

parent f4f2d267
......@@ -46,28 +46,6 @@ logger = logging.getLogger(__name__)
from . import utils
class Home(Resource):
"""The base resource path with subroutes"""
def get(self):
"""Returns the available sub-routes"""
return {
'routes': [
class Layout(Resource):
"""Exposes toolchain layout functionality"""
......@@ -101,17 +101,21 @@ def main(user_input=None):'BEAT prefix set to `%s\'', config.path)'BEAT cache set to `%s\'', config.cache)
from flask import Flask, request
from flask import Flask, request, redirect, url_for
from flask_restful import Api
from flask_cors import CORS
from ..resources import Home, Layout, Templates, Environments
from ..resources import Layout, Templates, Environments
from ..resources import VALID_ENTITIES, gen_endpoint
app = Flask(__name__)
static_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../js')
app = Flask(__name__, static_folder=static_folder, static_url_path='')
api = Api(app)
api.add_resource(Home, '/')
def home():
return redirect(url_for('static', filename='index.html'))
api.add_resource(Layout, '/layout', resource_class_kwargs={'config': config})
api.add_resource(Templates, '/templates', resource_class_kwargs={'config': config})
api.add_resource(Environments, '/environments')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment