Shape
Fields
ResourceContents
{ type: "text", text, mimeType? }{ type: "blob", blob, mimeType? }
Template URIs
If the resource URI contains{name} placeholders, Redop matches the concrete URI and passes the extracted values in params.
When you register the resource with a literal template URI, Redop also infers the params type from those placeholders. This means app.resource("users://{id}/profile", ...) gives you params.id: string in the handler, hooks, and resource middleware. Static resources do not get template params, so params is undefined there.
Redop also validates resource registration inputs early:
- the resource URI must be non-empty, trimmed, and free of whitespace
- the resource URI must include a valid scheme such as
file:,app:, orusers: - URI templates must have balanced
{}expressions - duplicate resource URIs are rejected
- the resource
namemust be non-empty and trimmed
Notes
- Use
afterResponsefor non-critical post-response work such as logging, metrics, or audit events. - Use
afterinstead when the logic must still be able to replace the successful resource result.