Skip to main content

Function: writeQueryToService()

writeQueryToService(directory): (query, service, options) => Promise<void>

Defined in: queries.ts:155

Write a query to a service in EventCatalog.

You can optionally override the path of the event.

Parameters

ParameterType
directorystring

Returns

Function

Parameters

ParameterType
queryQuery
service{ id: string; version: string; }
service.idstring
service.version?string
options{ format: "md" | "mdx"; override: boolean; path: string; }
options.format?"md" | "mdx"
options.override?boolean
options.path?string

Returns

Promise<void>

Example

import utils from '@eventcatalog/utils';

const { writeQueryToService } = utils('/path/to/eventcatalog');

// Write an event to a given service in the catalog
// Event would be written to services/Orders/queries/GetOrder
await writeQueryToService({
id: 'GetOrder',
name: 'Get Order',
version: '0.0.1',
summary: 'This is a summary',
markdown: '# Hello world',
}, { id: 'Orders' });