Skip to main content

toService

Callable

  • toService(directory: string): (file: string) => Promise<Service>

  • Takes a given raw file and converts it to a service.

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

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

    // Read the file from somewhere
    const file = fs.readFileSync('/path/to/services/InventoryService/index.mdx', 'utf8');

    // Converts the raw file to a service
    await toService(file);