Server
Nubo can run .nubo files as HTTP endpoints with the nubo serve command.
nubo serve appA server can serve either:
| Target | Behavior |
|---|---|
A single .nubo file | Every request runs that file. |
| A directory | Nubo builds routes from the files inside the directory. |
When a request reaches a Nubo executable file, the server injects these built-in server modules:
| Module | Description |
|---|---|
@server/request | Request method, headers, path, params, query, cookies, body, JSON, form data, and file uploads. |
@server/response | Status, headers, body writing, JSON, cookies, redirects, and response buffer control. |
@server/error | Available inside error.nubo for custom error pages. |
Basic Server File
Section titled “Basic Server File”Create a file named index.nubo:
import request from "@server/request"import response from "@server/response"
response.write(<h1>Hello from Nubo</h1>)Start the server:
nubo serve .Open:
http://localhost:3000Included Pages
Section titled “Included Pages”| Page | Description |
|---|---|
| Getting Started | Start a Nubo HTTP server. |
| Routing | File-based routes, index routes, dynamic params, and static files. |
| Request | Read request data from @server/request. |
| Response | Send responses with @server/response. |
| Errors | Default errors, custom error.nubo, and JSON error output. |
| Static Files | Serve non-executable files. |
| Cache | Parsed AST cache behavior. |
| Logging | Development request logs. |
| Configuration | Server config values. |
| Examples | Complete examples. |