Import
TypeScript
import { resource, resourceRegistry } from "veryfront/resource";Examples
TypeScript
import { resource } from "veryfront/resource";import { defineSchema } from "veryfront/schemas"; const docsBySection: Record<string, string> = { agents: "Agents accept messages, tools, context, and runtime options.", tools: "Tools expose schema-backed callable capabilities.",}; const docs = resource({ pattern: "docs/:section", description: "API documentation", paramsSchema: defineSchema((v) => v.object({ section: v.string() }))(), load: ({ section }) => { return { content: docsBySection[section] ?? "Section not found." }; },}); const result = await docs.load({ section: "agents" });API
resource(config)
Create a typed resource definition with unique URI-template parameter names.
Returns: <code>Resource<TParams, TData></code>