# PublishAsNodeServer

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

Configures the JavaScript application to publish as a standalone Node.js server that runs a built artifact directly.

## Remarks

Use this method for frameworks that produce a Node.js server artifact during the build and recommend
running that artifact directly in production rather than invoking a package manager script at runtime.
The application source is still built using the configured package manager and build script; this method
only changes the publish-time runtime container shape.
The container files source path is automatically set to `outputPath` so that only
the built output directory is copied into the runtime container, not the full application source.

## Definition

```go
func (JavaScriptAppResource) PublishAsNodeServer(
    entryPoint string,
    options ...*PublishAsNodeServerOptions,
) JavaScriptAppResource
```

## Parameters

- `entryPoint` (`string`) -- The relative path to the Node.js entry point to execute in the published container after the build completes, such as `.output/server/index.mjs` or `build/index.js`.
- `options` (`...*PublishAsNodeServerOptions`) -- optional settings, see [Options](#options)

## Options

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

- `OutputPath` (`*string`) -- The relative path containing the built runtime files to copy into the published container. Defaults to the application root.

## Returns

[`JavaScriptAppResource`](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md) -- The updated resource builder.

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

## Applies to

- [`BunAppResource`](/reference/api/go/aspire.hosting.javascript/bunappresource.md)
- [`DenoAppResource`](/reference/api/go/aspire.hosting.javascript/denoappresource.md)
- [`JavaScriptAppResource`](/reference/api/go/aspire.hosting.javascript/javascriptappresource.md)
- [`NextJsAppResource`](/reference/api/go/aspire.hosting.javascript/nextjsappresource.md)
- [`NodeAppResource`](/reference/api/go/aspire.hosting.javascript/nodeappresource.md)
- [`ViteAppResource`](/reference/api/go/aspire.hosting.javascript/viteappresource.md)
