Skip to main content
New project sponsor 🪝Hookdeck: Serverless infrastructure for event-driven architecture. Learn more.

writeService

Callable

  • writeService(directory: string): (service: Service, options?: { path: string }) => Promise<void>

  • Write an event to EventCatalog.

    You can optionally overide the path of the event.

    @example
    import utils from '@eventcatalog/utils';

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

    // Write a service
    // Event would be written to services/InventoryService
    await writeService({
    id: 'InventoryService',
    name: 'Inventory Service',
    version: '0.0.1',
    summary: 'Service that handles the inventory',
    markdown: '# Hello world',
    });

    // Write an event to the catalog but override the path
    // Event would be written to services/Inventory/InventoryService
    await writeService({
    id: 'InventoryService',
    name: 'Inventory Adjusted',
    version: '0.0.1',
    summary: 'This is a summary',
    markdown: '# Hello world',
    }, { path: "/Inventory/InventoryService"});