Skip to main content
Version: 0.7.x

Module: server

ComposeDB server for hybrid execution on the ComposeDB client.

Installation

npm install @composedb/server

Type Aliases

GraphQLParams

Ƭ GraphQLParams<ServerContext>: HandlerParams<ServerContext> & { port?: number | number[] }

Type parameters

NameType
ServerContextextends Record<string, unknown> = Record<string, unknown>

GraphQLServer

Ƭ GraphQLServer: Object

Type declaration

NameType
portnumber
stop() => Promise<void>

HandlerParams

Ƭ HandlerParams<ServerContext>: Object

Type parameters

NameType
ServerContextextends Record<string, unknown> = Record<string, unknown>

Type declaration

NameTypeDescription
cache?DocumentCacheOptional cache for documents.
ceramicCeramicAPI | stringCeramic client instance or HTTP URL.
definition?RuntimeCompositeDefinitionRuntime composite definition, created using the Composite development tools.
options?YogaServerOptions<ServerContext, Context>Yoga server options.
schema?GraphQLSchemaGraphQL Schema to use, ignores the definition parameter if provided.

Functions

createHandler

createHandler<ServerContext>(params): YogaServerInstance<ServerContext, Context>

Create a Yoga server handling GraphQL requests.

Type parameters

NameType
ServerContextextends Record<string, unknown> = Record<string, unknown>

Parameters

NameType
paramsHandlerParams<ServerContext>

Returns

YogaServerInstance<ServerContext, Context>


getViewerID

getViewerID(request): string | null | undefined

Returns the viewer ID sent by the client, if set.

Parameters

NameType
requestRequest

Returns

string | null | undefined


startGraphQLServer

startGraphQLServer<ServerContext>(params): Promise<GraphQLServer>

Start a local GraphQL server.

Type parameters

NameType
ServerContextextends Record<string, unknown> = Record<string, unknown>

Parameters

NameType
paramsGraphQLParams<ServerContext>

Returns

Promise<GraphQLServer>