Copy as Markdown[View as Markdown](/docs/sdk/functions/getServiceByPath.md)

***

# Function: getServiceByPath()

> **getServiceByPath**(`directory`): (`path`) => `Promise`<`Service`>

Defined in: services.ts:54

Returns a service from EventCatalog by it's path.

## Parameters[​](#parameters "Direct link to Parameters")

| Parameter   | Type     |
| ----------- | -------- |
| `directory` | `string` |

## Returns[​](#returns "Direct link to Returns")

`Function`

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter | Type     |
| --------- | -------- |
| `path`    | `string` |

### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`Service`>

## Example[​](#example "Direct link to Example")

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

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

// Returns a service from the catalog by it's path
const service = await getServiceByPath('/services/InventoryService/index.mdx');
```
