Static Files
When serving a directory, files that do not end in .nubo are served as static files.
nubo serve appExample:
app/ index.nubo style.css logo.pngRoutes:
| File | URL | Behavior |
|---|---|---|
index.nubo | / | Executed by Nubo. |
style.css | /style.css | Served as a static file. |
logo.png | /logo.png | Served as a static file. |
Static Files Are Not Executed
Section titled “Static Files Are Not Executed”Only .nubo files are executable.
app/data.jsonThe file above is served directly.
Static Fallback
Section titled “Static Fallback”If no route matches, Nubo tries to serve a built-in static file.
If that also fails, the request becomes a 404 Not Found.
Example HTML Page
Section titled “Example HTML Page”import response from "@server/response"
response.write("<!doctype html>")response.write(<html> <head> <link rel="stylesheet" href="/style.css" /> </head> <body> <h1>Hello</h1> </body></html>)Use an external stylesheet for normal CSS. Literal CSS braces inside an HTML literal can be interpreted as Nubo interpolation. If you need inline CSS, keep trusted CSS in a string and insert it explicitly:
let css = "body { color: navy; }"let style = <style>!{css}</style>
println(style)The document type is written as a string because it is not an ordinary HTML tag.