mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Updated sourcemap, and added a test package for template testing.
This commit is contained in:
14
src/frontend/lib/FastAPIServer.py
vendored
14
src/frontend/lib/FastAPIServer.py
vendored
@@ -12,8 +12,10 @@ templates = Jinja2Templates(directory="src/frontend/templates")
|
|||||||
|
|
||||||
|
|
||||||
class FastAPIServer():
|
class FastAPIServer():
|
||||||
|
"""Entry point for FastAPI server."""
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
|
"""Initialize FastAPIServer object parameters."""
|
||||||
self.config = config
|
self.config = config
|
||||||
app.mount("/static",
|
app.mount("/static",
|
||||||
StaticFiles(directory="src/frontend/static"),
|
StaticFiles(directory="src/frontend/static"),
|
||||||
@@ -27,9 +29,8 @@ class FastAPIServer():
|
|||||||
"""Compile static files for web frontend."""
|
"""Compile static files for web frontend."""
|
||||||
_pyShelf_src = sass.compile(
|
_pyShelf_src = sass.compile(
|
||||||
filename='src/frontend/static/styles/pyShelf.sass',
|
filename='src/frontend/static/styles/pyShelf.sass',
|
||||||
source_map_filename='src/frontend/node_modules/bulma/bulma.sass',
|
source_map_filename='src/frontend/static/styles/pyShelf.sass',
|
||||||
output_style='compressed'
|
output_style='compressed')
|
||||||
)
|
|
||||||
with open('src/frontend/static/styles/pyShelf.css', 'w') as _pyShelf:
|
with open('src/frontend/static/styles/pyShelf.css', 'w') as _pyShelf:
|
||||||
_pyShelf.write(_pyShelf_src[0])
|
_pyShelf.write(_pyShelf_src[0])
|
||||||
_pyShelf.close()
|
_pyShelf.close()
|
||||||
@@ -46,7 +47,12 @@ class FastAPIServer():
|
|||||||
"""Home page responder."""
|
"""Home page responder."""
|
||||||
return templates.TemplateResponse(
|
return templates.TemplateResponse(
|
||||||
"index.html",
|
"index.html",
|
||||||
{"request": request})
|
{
|
||||||
|
"request": request,
|
||||||
|
"package": {
|
||||||
|
"test": "This is a test variable"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
@app.get("/users/me")
|
@app.get("/users/me")
|
||||||
async def about_me(self):
|
async def about_me(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user