Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.editor
Commits
bfd808a6
Commit
bfd808a6
authored
May 02, 2018
by
Jaden DIEFENBAUGH
Browse files
[server] serve static files & redirect "/" to "index.html"
parent
f4f2d267
Changes
2
Hide whitespace changes
Inline
Side-by-side
beat/editor/resources.py
View file @
bfd808a6
...
...
@@ -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'
:
[
'databases'
,
'dataformats'
,
'libraries'
,
'algorithms'
,
'toolchains'
,
'experiments'
,
'plotters'
,
'plotterparameters'
,
'layout'
,
'environments'
,
]
}
class
Layout
(
Resource
):
"""Exposes toolchain layout functionality"""
...
...
beat/editor/scripts/server.py
View file @
bfd808a6
...
...
@@ -101,17 +101,21 @@ def main(user_input=None):
logger
.
info
(
'BEAT prefix set to `%s
\'
'
,
config
.
path
)
logger
.
info
(
'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
)
CORS
(
app
)
api
.
add_resource
(
Home
,
'/'
)
@
app
.
route
(
'/'
)
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'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment