Modules
A class with configure(self, m) owns its routes. Prefixes and imports compose the tree.
↑↓ to move · Enter to open · Esc to close
0.8.1
API framework
Nest-inspired HTTP APIs, written in Nox.
Modules, closure injection, guards, pipes, DTO validation, OpenAPI, WebSocket gateways and a SQLite job queue. Independent of Nyx.
noxc install github.com/mburakmmm/aether@v0.8.1Nox ≥ 2.0.7. The language itself is documented at noxlang.com.
import nox.http
from nox.http import HttpRequest, HttpResponse
import aether.application
import aether.server
import aether.config
from aether.application import Application
from aether.config import Config
from aether.module import ModuleBuilder
from aether.context import HttpContext
from aether.response import json_ok
class HealthModule:
def configure(self: HealthModule, m: ModuleBuilder) -> None:
m.get("/healthz", self._health())
def _health(self: HealthModule) -> (HttpContext) -> HttpResponse:
def health(ctx: HttpContext) -> HttpResponse:
return json_ok("{\"status\":\"ok\"}")
return health
def build(app: Application) -> None:
HealthModule().configure(app.module())
cfg: Config = aether.config.load()
aether.application.boot_for_serve(cfg, build)
def handle(req: HttpRequest) -> HttpResponse:
return aether.application.dispatch_from_parts(
req.method, req.target, req.body, req.headers, req.peer_addr, cfg, build
)
nox.http.serve(cfg.port, handle)Shape
Aether is the API and backend framework for Nox. Use it for JSON services. Use Nyx when the app is a monolith of HTML pages.
A class with configure(self, m) owns its routes. Prefixes and imports compose the tree.
Nox cannot subclass an imported base. Services live in fields and are captured by handlers.
Guard, pipe, interceptor, handler, interceptor, then an exception filter. OpenAPI is built at boot.
Surface
routes, guards, pipes, filters
DTOs, OpenAPI and Swagger UI
WebSocket rooms and a job queue
worker-local state, graceful drain
This site is a Nyx application on the same Cloudflare tunnel as noxlang.com. The language reference stays on the Nox site.