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
| Name | Type |
|---|---|
ServerContext | extends Record<string, any> = Record<string, any> |
GraphQLServer
Ƭ GraphQLServer: Object
Type declaration
| Name | Type |
|---|---|
port | number |
stop | () => Promise<void> |
HandlerParams
Ƭ HandlerParams<ServerContext>: Object
Type parameters
| Name | Type |
|---|---|
ServerContext | extends Record<string, any> = Record<string, any> |
Type declaration
| Name | Type | Description |
|---|---|---|
cache? | DocumentCache | Optional cache for documents. |
ceramic | CeramicApi | string | Ceramic client instance or HTTP URL. |
definition? | RuntimeCompositeDefinition | Runtime composite definition, created using the Composite development tools. |
options? | YogaServerOptions<ServerContext, Context> | Yoga server options. |
schema? | GraphQLSchema | GraphQL 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
| Name | Type |
|---|---|
ServerContext | extends Record<string, any> = Record<string, any> |
Parameters
| Name | Type |
|---|---|
params | HandlerParams<ServerContext> |
Returns
YogaServerInstance<ServerContext, Context>
getViewerID
▸ getViewerID(request): string | null | undefined
Returns the viewer ID sent by the client, if set.
Parameters
| Name | Type |
|---|---|
request | Request |
Returns
string | null | undefined
startGraphQLServer
▸ startGraphQLServer<ServerContext>(params): Promise<GraphQLServer>
Start a local GraphQL server.
Type parameters
| Name | Type |
|---|---|
ServerContext | extends Record<string, any> = Record<string, any> |
Parameters
| Name | Type |
|---|---|
params | GraphQLParams<ServerContext> |
Returns
Promise<GraphQLServer>