JavaScriptHostingExtensions.AddJavaScriptApp Method

Definition

Adds a JavaScript application resource to the distributed application using the specified app directory and run script.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.JavaScript.JavaScriptAppResource> AddJavaScriptApp(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, string appDirectory, string runScriptName = "dev");
static member AddJavaScriptApp : Aspire.Hosting.IDistributedApplicationBuilder * string * string * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.JavaScript.JavaScriptAppResource>
<Extension()>
Public Function AddJavaScriptApp (builder As IDistributedApplicationBuilder, name As String, appDirectory As String, Optional runScriptName As String = "dev") As IResourceBuilder(Of JavaScriptAppResource)

Parameters

builder
IDistributedApplicationBuilder

The distributed application builder to which the JavaScript application resource will be added.

name
String

The unique name of the JavaScript application resource. Cannot be null or empty.

appDirectory
String

The path to the directory containing the JavaScript application.

runScriptName
String

The name of the npm script to run when starting the application. Defaults to "dev". Cannot be null or empty.

Returns

A resource builder for the newly added JavaScript application resource.

Remarks

If a Dockerfile does not exist in the application's directory, one will be generated automatically when publishing. The method configures the resource with Node.js defaults and sets up npm integration.

Applies to