Libraries
    Preparing search index...

    Browser-safe entry point for @cleverbrush/server.

    Re-exports the endpoint builder, factory functions and type helpers needed to define API contracts without pulling in the Node.js server runtime. Use this entry point in shared packages that are consumed by both the backend (Node.js) and the frontend (browser).

    import { defineApi, endpoint, route } from '@cleverbrush/server/contract';
    import { array, number, object, string } from '@cleverbrush/schema';

    const TodoSchema = object({ id: number(), title: string() });

    export const api = defineApi({
    todos: {
    list: endpoint.resource('/api/todos').get()
    .responses({ 200: array(TodoSchema) }),
    get: endpoint.resource('/api/todos').get(
    route({ id: number().coerce() })`/${t => t.id}`
    ).responses({ 200: TodoSchema }),
    },
    });

    Type Aliases

    ApiContract
    ApiGroup

    Functions

    defineApi

    References

    ActionContext → ActionContext
    AllowedResponseReturn → AllowedResponseReturn
    CallbackDefinition → CallbackDefinition
    createEndpoints → createEndpoints
    endpoint → endpoint
    EndpointBuilder → EndpointBuilder
    EndpointMetadata → EndpointMetadata
    EndpointMetadataDescriptors → EndpointMetadataDescriptors
    Handler → Handler
    LinkDefinition → LinkDefinition
    PropertyRefTree → PropertyRefTree
    ResponsesOf → ResponsesOf
    route → route
    ScopedEndpointFactory → ScopedEndpointFactory
    SubscriptionBuilder → SubscriptionBuilder
    SubscriptionContext → SubscriptionContext
    SubscriptionHandler → SubscriptionHandler
    SubscriptionHandlerEntry → SubscriptionHandlerEntry
    SubscriptionMetadata → SubscriptionMetadata
    tracked → tracked
    TrackedEvent → TrackedEvent