Skip to main content

Function: toService()

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

Defined in: services.ts:497

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

Parameters​

ParameterTypeDescription
directorystringThe directory to convert the file to a service.

Returns​

Function

The service.

Parameters​

ParameterType
filestring

Returns​

Promise<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);