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 , unknown > = Record <string , unknown > |
GraphQLServer
Ƭ GraphQLServer: Object
Type declaration
Name | Type |
---|---|
port | number |
stop | () => Promise <void > |
HandlerParams
Ƭ HandlerParams<ServerContext
>: Object
Type parameters
Name | Type |
---|---|
ServerContext | extends Record <string , unknown > = Record <string , unknown > |
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 , unknown > = Record <string , unknown > |
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 , unknown > = Record <string , unknown > |
Parameters
Name | Type |
---|---|
params | GraphQLParams <ServerContext > |
Returns
Promise
<GraphQLServer
>