# JavaScriptAppResource.WithRunScript

- Module: [Aspire.Hosting.JavaScript](/reference/api/go/aspire.hosting.javascript.md)
- Defined on: [JavaScriptAppResource](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md)
- Version: `17.0.0`
- Kind: `method`

Adds a run script annotation to the specified JavaScript application resource builder, specifying the script to execute and its arguments during run mode.

## Remarks

Use this method to specify a custom script and its arguments that should be executed when the resource is executed
in RunMode.

## Definition

```go
type JavaScriptAppResource interface {
    // ... omitted for brevity
    WithRunScript(
        scriptName string,
        options ...*WithRunScriptOptions,
    ) JavaScriptAppResource
}
```

## Signature

```go
WithRunScript(
    scriptName string,
    options ...*WithRunScriptOptions,
) JavaScriptAppResource
```

## Parameters

- `scriptName` (`string`) -- The name of the script to be executed when the resource is run.
- `options` (`...*WithRunScriptOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithRunScriptOptions` argument.

- `Args` (`[]string`) -- An array of arguments to pass to the script.

## Returns

[`JavaScriptAppResource`](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md) -- The same resource builder instance with the run script annotation applied, enabling further configuration.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [JavaScriptAppResource](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md) -- `handle`
