Skip to content

Static Files

When serving a directory, files that do not end in .nubo are served as static files.

Terminal window
nubo serve app

Example:

app/
index.nubo
style.css
logo.png

Routes:

FileURLBehavior
index.nubo/Executed by Nubo.
style.css/style.cssServed as a static file.
logo.png/logo.pngServed as a static file.

Only .nubo files are executable.

app/data.json

The file above is served directly.

If no route matches, Nubo tries to serve a built-in static file.

If that also fails, the request becomes a 404 Not Found.

import response from "@server/response"
response.write("<!doctype html>") // the doctype part should be written as string
// because Nubo only supports simple html tags
response.write(<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Hello</h1>
</body>
</html>)

Do not use <style> tags, because the parser may fail to parse nubo code between {}. Only use style if really needed, and with <style>{content}</style>, and make content the css content in string.