docs: host the docs at green-tea.expressive-tea.io/docs
The site hangs off the expressive-tea.io cPanel as green-tea.expressive-tea.io. A four-level docs.green-tea.expressive-tea.io subdomain reads badly and would need its own AutoSSL cert (the *.expressive-tea.io wildcard stops one level up). A /docs subfolder needs no extra host, DNS, or cert — it's a path — and is what most projects do. So the docs site now builds with base: '/docs' (its dist/ contents drop into the subdomain's docs/ folder in cPanel), the 77 hard-coded content links are prefixed, and the two hero actions Starlight doesn't rewrite are fixed by hand. Verified: /docs/ serves, / 404s, no unprefixed internal href remains. README points at the new docs URL. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
23 files changed
+78
-77
No files matched your search
@@ -34,7 +34,7 @@ getUser(@needs('user') user: any, @param('id') id: string) {
|
||||
}
|
||||
```
|
||||
|
||||
See [Dependency injection](/guides/dependency-injection/) for how `needs`/`provides` build the
|
||||
See [Dependency injection](/docs/guides/dependency-injection/) for how `needs`/`provides` build the
|
||||
graph.
|
||||
|
||||
## `@ctx` — the whole context
|
||||
@@ -94,7 +94,7 @@ needs a name to say which route param it binds. `@body(Schema)`, `@query(Schema)
|
||||
object.
|
||||
:::
|
||||
|
||||
A failing schema short-circuits the request with **422**. See [Validation](/guides/validation/)
|
||||
A failing schema short-circuits the request with **422**. See [Validation](/docs/guides/validation/)
|
||||
for the full contract (fail-fast order, error shape, async schemas, and caveats).
|
||||
|
||||
## Multipart access asymmetry
|
||||
@@ -138,11 +138,11 @@ echo(@inbound() incoming: AsyncIterable<string>) {
|
||||
}
|
||||
```
|
||||
|
||||
See [Streaming](/guides/streaming/) for SSE, WebSocket duplex, and channels.
|
||||
See [Streaming](/docs/guides/streaming/) for SSE, WebSocket duplex, and channels.
|
||||
|
||||
## Where to go next
|
||||
|
||||
- How injected values are produced: [Dependency injection](/guides/dependency-injection/).
|
||||
- The mental model: [The graph](/concepts/the-graph/).
|
||||
- Validating and coercing injected values: [Validation](/guides/validation/).
|
||||
- The full API surface: [Decorator reference](/reference/decorators/).
|
||||
- How injected values are produced: [Dependency injection](/docs/guides/dependency-injection/).
|
||||
- The mental model: [The graph](/docs/concepts/the-graph/).
|
||||
- Validating and coercing injected values: [Validation](/docs/guides/validation/).
|
||||
- The full API surface: [Decorator reference](/docs/reference/decorators/).
|
||||
@@ -138,9 +138,9 @@ receive `undefined`. Boot fails loudly, so you never serve `undefined`.
|
||||
|
||||
## Where to go next
|
||||
|
||||
- New to green-tea? Start with [Getting started](/getting-started/).
|
||||
- The mental model behind all of this: [The graph](/concepts/the-graph/).
|
||||
- Everything a handler can inject: [Argument decorators](/guides/arguments/) and the
|
||||
[decorator reference](/reference/decorators/).
|
||||
- Coerce and validate injected values with Standard Schema: [Validation](/guides/validation/).
|
||||
- Declare `@Sse` and return an `AsyncIterable` to push data over time: [Streaming](/guides/streaming/).
|
||||
- New to green-tea? Start with [Getting started](/docs/getting-started/).
|
||||
- The mental model behind all of this: [The graph](/docs/concepts/the-graph/).
|
||||
- Everything a handler can inject: [Argument decorators](/docs/guides/arguments/) and the
|
||||
[decorator reference](/docs/reference/decorators/).
|
||||
- Coerce and validate injected values with Standard Schema: [Validation](/docs/guides/validation/).
|
||||
- Declare `@Sse` and return an `AsyncIterable` to push data over time: [Streaming](/docs/guides/streaming/).
|
||||
@@ -64,5 +64,5 @@ const app = createApp({
|
||||
`onError` intercepts **every** HTTP error response — handler/step throws, a `404` for an unmatched route, `405`, a `413` (body too large), and a `400` (malformed body) — so your error surface is consistent across the whole app. Streaming and WebSocket errors are out of scope (they surface as an error frame or a WebSocket close code, not a response body).
|
||||
|
||||
:::note
|
||||
Errors are also observable without changing the response: subscribe to `request:step:error` (and `stream:error`) on [`app.bus`](/guides/plugins/) to log or trace them.
|
||||
Errors are also observable without changing the response: subscribe to `request:step:error` (and `stream:error`) on [`app.bus`](/docs/guides/plugins/) to log or trace them.
|
||||
:::
|
||||
@@ -37,7 +37,7 @@ class AboutController {
|
||||
}
|
||||
```
|
||||
|
||||
Reading a file needs a filesystem, so this mode is Node/Deno/Bun only — see [Runtimes](/guides/runtimes/) for the edge alternative.
|
||||
Reading a file needs a filesystem, so this mode is Node/Deno/Bun only — see [Runtimes](/docs/guides/runtimes/) for the edge alternative.
|
||||
|
||||
### 3. Render a template — Node/Deno/Bun
|
||||
|
||||
@@ -134,7 +134,7 @@ const app3 = createApp({ modules: [ApiModule], static: '/srv/site' }); // absolu
|
||||
- **Declared routes always win.** Static is only consulted when nothing matched, so `@Get('/api/ping')` is never shadowed by a file at `public/api/ping`.
|
||||
- Path traversal (`../`, encoded or not) is rejected — a request can't escape the static root.
|
||||
|
||||
Like the file/template modes of `@Html`, `static` needs a filesystem: it's Node/Deno/Bun only. Configuring it on an edge runtime throws at `createApp()` time — see [Runtimes](/guides/runtimes/).
|
||||
Like the file/template modes of `@Html`, `static` needs a filesystem: it's Node/Deno/Bun only. Configuring it on an edge runtime throws at `createApp()` time — see [Runtimes](/docs/guides/runtimes/).
|
||||
|
||||
## The boot rule
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ title: Graph introspection
|
||||
description: "explain, graph, toMermaid, and the graph endpoint."
|
||||
---
|
||||
|
||||
Because the request/boot pipeline is an explicit [dependency graph](/concepts/the-graph/),
|
||||
Because the request/boot pipeline is an explicit [dependency graph](/docs/concepts/the-graph/),
|
||||
you can inspect it directly — visualize the whole thing, or explain exactly which nodes a
|
||||
single route runs.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ description: "Distributed dependency injection over a secret-gated WebSocket con
|
||||
Mesh is **alpha** — its API and wire protocol may change between releases, and discovery, load-balancing, and failover are not built. It is gated behind an explicit opt-in: `createApp({ mesh, experimental: true })`, and `createApp` **throws** if you configure `mesh` without `experimental: true`. **Don't ship mesh to production yet.**
|
||||
:::
|
||||
|
||||
A **teacup** can depend on a token that physically lives on another node — a **teapot**. `@needs('billing')` resolves the same whether `billing` runs in this process or on a remote one. There's no gRPC layer or message-pattern DSL: there's the [graph](/concepts/the-graph/), and some nodes happen to live elsewhere.
|
||||
A **teacup** can depend on a token that physically lives on another node — a **teapot**. `@needs('billing')` resolves the same whether `billing` runs in this process or on a remote one. There's no gRPC layer or message-pattern DSL: there's the [graph](/docs/concepts/the-graph/), and some nodes happen to live elsewhere.
|
||||
|
||||
Exports are opt-in (`export: true`) and the control channel is gated by a shared secret.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ title: OpenAPI
|
||||
description: "Generate a structural OpenAPI 3.1 document from the route graph."
|
||||
---
|
||||
|
||||
Because the request pipeline is [data you can read](/concepts/the-graph/), green-tea can project it — the same way it renders [Mermaid/DOT](/guides/introspection/), it emits **OpenAPI**.
|
||||
Because the request pipeline is [data you can read](/docs/concepts/the-graph/), green-tea can project it — the same way it renders [Mermaid/DOT](/docs/guides/introspection/), it emits **OpenAPI**.
|
||||
|
||||
## `app.openapi()`
|
||||
|
||||
@@ -36,6 +36,6 @@ const app = createApp({ modules: [ApiModule], devOpenapi: true });
|
||||
|
||||
This is a **structural** spec: paths, methods, parameters, which routes take a body, and the standard error responses. What it does **not** include yet:
|
||||
|
||||
- **Request/response body schemas.** [Standard Schema](/guides/validation/) (zod/valibot/arktype) validates input but does not expose a JSON Schema representation, so body shapes are documented generically. Parameter types default to `string`.
|
||||
- **Request/response body schemas.** [Standard Schema](/docs/guides/validation/) (zod/valibot/arktype) validates input but does not expose a JSON Schema representation, so body shapes are documented generically. Parameter types default to `string`.
|
||||
|
||||
Full schemas — declared and enforced on the way out via a `@Produce(schema)` decorator that also validates responses — are on the roadmap for the stable release. For beta, the structural document already drives Swagger UI, client codegen, and API diffing.
|
||||
@@ -30,7 +30,7 @@ and the framework computes where that node lands.
|
||||
Because execution is per-route (a route runs only the transitive closure of its handler's
|
||||
`@needs`), a plugin step that should run on **every** route must produce nothing — add it
|
||||
with `provides: []`. A step that produces no token has nothing to gate on, so the framework
|
||||
runs it unconditionally. See [The graph](/concepts/the-graph/) for how the closure is
|
||||
runs it unconditionally. See [The graph](/docs/concepts/the-graph/) for how the closure is
|
||||
computed.
|
||||
:::
|
||||
|
||||
@@ -55,4 +55,4 @@ The full event vocabulary:
|
||||
|
||||
Observation is read-only: handlers see the event payload but can't alter control flow. To
|
||||
change behavior, contribute a node to your scope — see
|
||||
[Dependency injection](/guides/dependency-injection/).
|
||||
[Dependency injection](/docs/guides/dependency-injection/).
|
||||
@@ -51,7 +51,7 @@ When more than one route matches the same path, the **most specific wins** — `
|
||||
A path that no route matches returns `404`. A path that **does** exist but under a different method returns **`405 Method Not Allowed`** with an `Allow` header listing the methods that do match — not a `404`.
|
||||
|
||||
:::note
|
||||
A bare `OPTIONS` request (without an `Access-Control-Request-Method` header — i.e. not a CORS preflight) to an existing path therefore returns `405` with `Allow`. CORS preflights are handled separately; see [Transport security](/guides/security/).
|
||||
A bare `OPTIONS` request (without an `Access-Control-Request-Method` header — i.e. not a CORS preflight) to an existing path therefore returns `405` with `Allow`. CORS preflights are handled separately; see [Transport security](/docs/guides/security/).
|
||||
:::
|
||||
|
||||
## Not yet
|
||||
@@ -61,4 +61,4 @@ The matcher is intentionally small for beta. **Not built** (on the roadmap):
|
||||
- Regex / typed param constraints such as `:id(\d+)`.
|
||||
- Route matching is a **linear scan** — fine for typical route tables, but a radix-tree matcher for very large ones isn't implemented.
|
||||
|
||||
See [Streaming & real-time](/guides/streaming/) for `@Sse` / `@Ws` / `@Stream`, and [Argument decorators](/guides/arguments/) for everything a handler can read from a request.
|
||||
See [Streaming & real-time](/docs/guides/streaming/) for `@Sse` / `@Ws` / `@Stream`, and [Argument decorators](/docs/guides/arguments/) for everything a handler can read from a request.
|
||||
@@ -60,7 +60,7 @@ Any runtime can build a `WsSocket` capability (`inbound`, `abort`, `isOpen`, `se
|
||||
same primitive (see below).
|
||||
|
||||
**Still Node-only:** `app.listen()`, TLS and per-request timeouts. On Deno you get
|
||||
`app.fetch` + `serveDeno`. [Mesh](/guides/mesh/) works here: the control channel is
|
||||
`app.fetch` + `serveDeno`. [Mesh](/docs/guides/mesh/) works here: the control channel is
|
||||
served through `app.upgrade` and the teacup connects with Deno's global `WebSocket`.
|
||||
|
||||
## WebSocket on Bun
|
||||
@@ -83,7 +83,7 @@ serveBun(app, { port: 8000 });
|
||||
run on Node and Deno. Behaviour matches the Node reference.
|
||||
|
||||
**Still Node-only:** `app.listen()`, TLS and per-request timeouts. On Bun you get
|
||||
`app.fetch` + `serveBun`. [Mesh](/guides/mesh/) works here too.
|
||||
`app.fetch` + `serveBun`. [Mesh](/docs/guides/mesh/) works here too.
|
||||
|
||||
## Cloudflare Workers / edge
|
||||
|
||||
@@ -115,7 +115,7 @@ compatibility_date = "2024-09-23" # or later
|
||||
Green Tea's core statically imports Node built-ins that workerd only provides under
|
||||
this flag; without it, the Worker fails to load.
|
||||
|
||||
**Still Node-only:** `app.listen()`, TLS and per-request timeouts. [Mesh](/guides/mesh/)
|
||||
**Still Node-only:** `app.listen()`, TLS and per-request timeouts. [Mesh](/docs/guides/mesh/)
|
||||
is **not** supported on edge: the teapot's secret comparison needs `node:crypto`'s
|
||||
`timingSafeEqual`, which `nodejs_compat` does not provide. Cloudflare's
|
||||
Durable Objects and WebSocket Hibernation are **not** used — `edgeHandler` accepts
|
||||
@@ -124,7 +124,7 @@ open for its lifetime rather than hibernating between messages.
|
||||
|
||||
## Filesystem features — Node/Deno/Bun only
|
||||
|
||||
A few [HTML & views](/guides/html/) features read from disk, so they need a runtime with
|
||||
A few [HTML & views](/docs/guides/html/) features read from disk, so they need a runtime with
|
||||
a filesystem:
|
||||
|
||||
- `@Html('file.html')` — reads and caches the file at boot.
|
||||
|
||||
@@ -4,7 +4,7 @@ description: "TLS and wss, secure-by-default headers, CORS, and trustProxy."
|
||||
---
|
||||
|
||||
Four `createApp` options cover TLS, proxying, CORS, and response headers: `tls`,
|
||||
`trustProxy`, `cors`, and `security`. See the [`createApp` reference](/reference/createapp/)
|
||||
`trustProxy`, `cors`, and `security`. See the [`createApp` reference](/docs/reference/createapp/)
|
||||
for the full option list.
|
||||
|
||||
## TLS (native https/wss)
|
||||
@@ -97,5 +97,5 @@ strips and sets forwarded headers itself, and terminate TLS where you control th
|
||||
|
||||
## Related
|
||||
|
||||
- [`createApp` reference](/reference/createapp/) — every construction option
|
||||
- [File uploads / multipart](/guides/uploads/) — request-body handling
|
||||
- [`createApp` reference](/docs/reference/createapp/) — every construction option
|
||||
- [File uploads / multipart](/docs/guides/uploads/) — request-body handling
|
||||
@@ -22,7 +22,7 @@ The primitive never changes — it's always an `AsyncIterable`. What changes is
|
||||
- **`@Stream`** — you write the handler once; the client's request decides whether it arrives as SSE, ndjson, or a WebSocket. No branching in your code.
|
||||
|
||||
:::note
|
||||
Streaming bypasses the response transformer — the transport frames each value directly, handles backpressure, and cleans up on disconnect. See [arguments](/guides/arguments/) for the full list of argument decorators, including the stream-only `@inbound()` and `@abort()`.
|
||||
Streaming bypasses the response transformer — the transport frames each value directly, handles backpressure, and cleans up on disconnect. See [arguments](/docs/guides/arguments/) for the full list of argument decorators, including the stream-only `@inbound()` and `@abort()`.
|
||||
:::
|
||||
|
||||
## Streaming — SSE
|
||||
@@ -101,7 +101,7 @@ class Live {
|
||||
|
||||
Same `@Route`, same handler shape, same `AsyncIterable` — real-time is not a separate framework you also have to learn.
|
||||
|
||||
`rooms` is the built-in shared `Rooms` primitive (one instance app-wide). A typical chat handler pumps the `@inbound()` channel into `rooms.room(name)` and returns that same room as its outbound channel, so every joined socket multicasts to the others. A handshake `@Step` can read `?token=` and throw `Unauthorized` — which closes the socket with code **4401** (`4000 + status`). See [security](/guides/security/) for handshake authentication.
|
||||
`rooms` is the built-in shared `Rooms` primitive (one instance app-wide). A typical chat handler pumps the `@inbound()` channel into `rooms.room(name)` and returns that same room as its outbound channel, so every joined socket multicasts to the others. A handshake `@Step` can read `?token=` and throw `Unauthorized` — which closes the socket with code **4401** (`4000 + status`). See [security](/docs/guides/security/) for handshake authentication.
|
||||
|
||||
## Transport is declared, not inferred
|
||||
|
||||
|
||||
@@ -29,5 +29,5 @@ An override for an unknown token throws. The set of tokens is validated against
|
||||
graph, so a typo'd or stale override is a construction-time error, not a silent no-op.
|
||||
:::
|
||||
|
||||
This pairs well with [`app.explain(route)`](/guides/introspection/) — explain the chain to
|
||||
This pairs well with [`app.explain(route)`](/docs/guides/introspection/) — explain the chain to
|
||||
see which tokens a route actually depends on, then override exactly those.
|
||||
@@ -27,7 +27,7 @@ class ProfileController {
|
||||
`UploadedFile` is `{ filename, contentType, data: Buffer, size }` — the whole file is buffered in memory, no temp files.
|
||||
|
||||
:::note[Access asymmetry]
|
||||
For multipart, `@body('title')` returns `undefined` — the value lives at `body.fields.title`, not `body.title`, unlike JSON/urlencoded where `@body('title')` picks the value directly. Use `@body()` and read `.fields`/`.files`, or key into the envelope itself with `@body('fields')` / `@body('files')`. See [arguments](/guides/arguments/) for how `@body()` behaves across content types.
|
||||
For multipart, `@body('title')` returns `undefined` — the value lives at `body.fields.title`, not `body.title`, unlike JSON/urlencoded where `@body('title')` picks the value directly. Use `@body()` and read `.fields`/`.files`, or key into the envelope itself with `@body('fields')` / `@body('files')`. See [arguments](/docs/guides/arguments/) for how `@body()` behaves across content types.
|
||||
:::
|
||||
|
||||
## Repeated fields — `bodyDuplicates`
|
||||
@@ -67,5 +67,5 @@ uploadAvatar(@body() form: MultipartBody) { /* ... */ }
|
||||
A route's `maxBodyBytes` / `maxParts` fall back to the server-wide `limits` when unset. A malformed multipart body (bad boundary, missing headers, truncated part) → **400**.
|
||||
|
||||
:::note
|
||||
To validate parsed fields against a schema, pass a Standard Schema to `@body()` — see [validation](/guides/validation/).
|
||||
To validate parsed fields against a schema, pass a Standard Schema to `@body()` — see [validation](/docs/guides/validation/).
|
||||
:::
|
||||
@@ -48,7 +48,7 @@ needs a name to say which route param it binds. `@body(Schema)`, `@query(Schema)
|
||||
object (all of `body`/`query`/`headers`).
|
||||
:::
|
||||
|
||||
See [Argument decorators](/guides/arguments/) for the full slot semantics of each decorator.
|
||||
See [Argument decorators](/docs/guides/arguments/) for the full slot semantics of each decorator.
|
||||
|
||||
## Failure: 422 with per-field issues
|
||||
|
||||
@@ -79,6 +79,6 @@ validation are all out of scope for this feature.
|
||||
|
||||
## Related
|
||||
|
||||
- [Argument decorators](/guides/arguments/) — every slot decorator and its parsing rules
|
||||
- [File uploads / multipart](/guides/uploads/) — how multipart bodies are parsed before validation
|
||||
- [`createApp` reference](/reference/createapp/) — app construction options
|
||||
- [Argument decorators](/docs/guides/arguments/) — every slot decorator and its parsing rules
|
||||
- [File uploads / multipart](/docs/guides/uploads/) — how multipart bodies are parsed before validation
|
||||
- [`createApp` reference](/docs/reference/createapp/) — app construction options
|
||||
Reference in new issue
Block a user