# AddNodeApp

- Module: [Aspire.Hosting.JavaScript](/reference/api/go/aspire.hosting.javascript.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: `DistributedApplicationBuilder`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds a node application to the application model. Node should be available on the PATH.

## Remarks

This method executes a Node script directly using `node script.js`. If you want to use a package manager
you can add one and configure the install and run scripts using the provided extension methods.
If the application directory contains a `package.json` file, npm will be added as the default package manager.

## Definition

```go
func (DistributedApplicationBuilder) AddNodeApp(
    name string,
    appDirectory string,
    scriptPath string,
) NodeAppResource
```

## Parameters

- `name` (`string`) -- The name of the resource.
- `appDirectory` (`string`) -- The path to the directory containing the node application.
- `scriptPath` (`string`) -- The path to the script relative to the app directory to run.

## Returns

[`NodeAppResource`](/reference/api/go/aspire.hosting.javascript/nodeappresource.md) -- The resource builder.

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

## Applies to

- `DistributedApplicationBuilder`
