> For the complete documentation index, see [llms.txt](https://marblejs.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://marblejs.gitbook.io/docs/v2/api-reference/core/core-effectfactory.md).

# EffectFactory

Set of factory functions for building router Effect.

## **Importing**

```typescript
import { EffectFactory } from '@marblejs/core';
```

## + **matchPath**

`EffectFactory` namespace function. Matches request path for connected *Effect*.

### **Type declaration**

```typescript
matchPath :: string -> matchType
```

### **Parameters**

| *parameter* | definition |
| ----------- | ---------- |
| *path*      | `string`   |

### Returns

EffectFactory `matchType` function

## + **matchType**

`EffectFactory` namespace function. Matches HTTP method type for connected *Effect*.

### **Type declaration**

```typescript
matchType :: HttpMethod -> use
```

### **Parameters**

| *parameter* | definition                                                                                                          |
| ----------- | ------------------------------------------------------------------------------------------------------------------- |
| *type*      | `HttpMethod = 'POST \| 'PUT' \| 'PATCH' \| 'GET' \| 'HEAD' \| 'DELETE' \| 'CONNECT' \| 'OPTIONS' \| 'TRACE' \| '*'` |

### Returns

EffectFactory *`use`* function

## + **use**

`EffectFactory` namespace function. Connects *Effect* with path and HTTP method type.

### **Type declaration**

```typescript
use :: HttpEffect -> RouteEffect
```

### **Parameters**

| *parameter* | definition            |
| ----------- | --------------------- |
| *effect*    | `HttpEffect` function |

### Returns

Factorized `RouteEffect` object.

## Example

{% code title="root.effect.ts" %}

```typescript
import { EffectFactory } from '@marblejs/core';

export const root$ = EffectFactory
  .matchPath('/')
  .matchType('GET')
  .use(req$ => req$.pipe(
    mapTo({ body: `Hello, world! 👻` })
  ));
```

{% endcode %}
