# snizu function run

Source: https://snizu.dev/docs/cli/function/run

## Usage [#usage]

```sh title="Usage"
snizu function run [dir] [--input sample.json]
```

## Flags [#flags]

<Fields>
<Field name="[dir]" type="path">
The function's folder. The current one by default.
</Field>

<Field name="--input" type="file">
The JSON to give it. The folder's `sample.json` by default.
</Field>
</Fields>

It runs `dist/function.wasm` the way the platform does: the input on standard input, the answer read from standard output, and nothing else to reach. Build it first with [`snizu function build`](/docs/cli/function/build).

## Examples [#examples]

```shellsession title="Terminal"
$ snizu function run
{"discounts":[{"title":"10% off","value":{"percentage":10},"target":"order"}]}
! This is a quick check: the fuel and memory limits only apply on the server.
```

Try another cart by writing it to a file:

```shellsession title="Terminal"
$ snizu function run --input small-cart.json
{"discounts":[]}
! This is a quick check: the fuel and memory limits only apply on the server.
```

<Callout tone="warning" title="Limits apply on the server">
Here nothing counts fuel or caps memory. A function that answers here can still run out on the platform: keep loops bounded by the cart's size.
</Callout>