Function: toService()
toService(
directory): (file) =>Promise<Service>
Defined in: services.ts:497
Takes a given raw file and converts it to a service.
Parameters
| Parameter | Type | Description |
|---|---|---|
directory | string | The directory to convert the file to a service. |
Returns
Function
The service.
Parameters
| Parameter | Type |
|---|---|
file | string |
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);