The ApiOptions define how the Vendure GraphQL APIs are exposed, as well as allowing the API layer to be extended with middleware.
string''Set the hostname of the server. If not set, the server will be available on localhost.
number3000Which port the Vendure server should listen on.
string'admin-api'The path to the admin GraphQL API.
string'shop-api'The path to the shop GraphQL API.
boolean | RenderPageOptionsfalseThe playground config to the admin GraphQL API ApolloServer playground.
boolean | RenderPageOptionsfalseThe playground config to the shop GraphQL API ApolloServer playground.
booleanfalseThe debug config to the admin GraphQL API ApolloServer playground.
booleanfalseThe debug config to the shop GraphQL API ApolloServer playground.
number100The maximum number of items that may be returned by a query which returns a PaginatedList response. In other words,
this is the upper limit of the take input option.
number1000The maximum number of items that may be returned by a query which returns a PaginatedList response. In other words,
this is the upper limit of the take input option.
Array<(context: ValidationContext) => any>[]Custom functions to use as additional validation rules when validating the schema for the admin GraphQL API ApolloServer validation rules.
Array<(context: ValidationContext) => any>[]Custom functions to use as additional validation rules when validating the schema for the shop GraphQL API ApolloServer validation rules.
string'vendure-token'The name of the property which contains the token of the active channel. This property can be included either in the request header or as a query string.
boolean | CorsOptions{ origin: true, credentials: true }Set the CORS handling for the server. See the express CORS docs.
Middleware[][]Custom Express or NestJS middleware for the server. More information can be found in the Middleware docs.
falseSet the trust proxy configuration for the server. See the express proxy docs.
ApolloServerPlugin[][]Custom ApolloServerPlugins which allow the extension of the Apollo Server, which is the underlying GraphQL server used by Vendure.
Apollo plugins can be used e.g. to perform custom data transformations on incoming operations or outgoing data.
booleanv1.5.0trueControls whether introspection of the GraphQL APIs is enabled. For production, it is recommended to disable introspection, since exposing your entire schema can allow an attacker to trivially learn all operations and much more easily find any potentially exploitable queries.
Note: when introspection is disabled, tooling which relies on it for things like autocompletion will not work.
Example