fn register(app)
fn read_asset(primary_path, secondary_path)
try
return str(read_file(primary_path))
except
return str(read_file(secondary_path))
fn app_shell()
return read_asset(
"examples/twitter_clone/static/index.html",
"static/index.html"
)
@app.get("/")
fn index()
return Response(app_shell(), content_type="text/html; charset=utf-8")
@app.get("/u/<username>")
fn profile_page(username)
return Response(app_shell(), content_type="text/html; charset=utf-8")
@app.get("/static/app.js")
fn app_js()
return Response(
read_asset(
"examples/twitter_clone/static/app.js",
"static/app.js"
),
content_type="application/javascript"
)
@app.get("/static/styles.css")
fn styles_css()
return Response(
read_asset(
"examples/twitter_clone/static/styles.css",
"static/styles.css"
),
content_type="text/css"
)