Skip to content
Docs Try Aspire

JavaScriptHostingExtensions Methods

Class Methods 13 members
Provides extension methods for adding JavaScript applications to the distributed application builder.
AddApp(IResourceBuilder<NxResource>, string, string?, Func<IResourceBuilder<NxAppResource>, IResourceBuilder<NxAppResource>>) Section titled AddApp(IResourceBuilder<NxResource>, string, string?, Func<IResourceBuilder<NxAppResource>, IResourceBuilder<NxAppResource>>) extension IResourceBuilder<NxAppResource>
Adds an individual app to an Nx workspace.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<NxAppResource> AddApp(
this IResourceBuilder<NxResource> builder,
string name,
string? appName = null,
Func<IResourceBuilder<NxAppResource>, IResourceBuilder<NxAppResource>>? configure = null)
{
// ...
}
}
builder IResourceBuilder<NxResource> The Nx workspace resource builder.
name string The name of the app resource.
appName string? optional The Nx app name to run. If not specified, uses the name.
configure Func<IResourceBuilder<NxAppResource>, IResourceBuilder<NxAppResource>> optional A function to configure the app resource builder.
IResourceBuilder<NxAppResource> A reference to the ApplicationModel.IResourceBuilder`1.
AddApp(IResourceBuilder<TurborepoResource>, string, string?, Func<IResourceBuilder<TurborepoAppResource>, IResourceBuilder<TurborepoAppResource>>) Section titled AddApp(IResourceBuilder<TurborepoResource>, string, string?, Func<IResourceBuilder<TurborepoAppResource>, IResourceBuilder<TurborepoAppResource>>) extension IResourceBuilder<TurborepoAppResource>
Adds an individual app to a Turborepo workspace.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<TurborepoAppResource> AddApp(
this IResourceBuilder<TurborepoResource> builder,
string name,
string? filter = null,
Func<IResourceBuilder<TurborepoAppResource>, IResourceBuilder<TurborepoAppResource>>? configure = null)
{
// ...
}
}
builder IResourceBuilder<TurborepoResource> The Turborepo workspace resource builder.
name string The name of the app resource.
filter string? optional The Turborepo filter to use. If not specified, uses the name.
configure Func<IResourceBuilder<TurborepoAppResource>, IResourceBuilder<TurborepoAppResource>> optional A function to configure the app resource builder.
IResourceBuilder<TurborepoAppResource> A reference to the ApplicationModel.IResourceBuilder`1.
AddNxApp(IDistributedApplicationBuilder, string, string?) Section titled AddNxApp(IDistributedApplicationBuilder, string, string?) extension IResourceBuilder<NxResource>
Adds an Nx monorepo workspace to the distributed application builder.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<NxResource> AddNxApp(
this IDistributedApplicationBuilder builder,
string name,
string? workingDirectory = null)
{
// ...
}
}
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder to add the resource to.
name string The name of the Nx workspace resource.
workingDirectory string? optional The working directory of the Nx workspace. If not specified, it will be set to a path that is a sibling of the AppHost directory using the name as the folder.
IResourceBuilder<NxResource> A reference to the ApplicationModel.IResourceBuilder`1.
AddTurborepoApp(IDistributedApplicationBuilder, string, string?) Section titled AddTurborepoApp(IDistributedApplicationBuilder, string, string?) extension IResourceBuilder<TurborepoResource>
Adds a Turborepo monorepo workspace to the distributed application builder.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<TurborepoResource> AddTurborepoApp(
this IDistributedApplicationBuilder builder,
string name,
string? workingDirectory = null)
{
// ...
}
}
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder to add the resource to.
name string The name of the Turborepo workspace resource.
workingDirectory string? optional The working directory of the Turborepo workspace. If not specified, it will be set to a path that is a sibling of the AppHost directory using the name as the folder.
IResourceBuilder<TurborepoResource> A reference to the ApplicationModel.IResourceBuilder`1.
WithMappedEndpointPort(IResourceBuilder<TResource>, string?) Section titled WithMappedEndpointPort(IResourceBuilder<TResource>, string?) extension IResourceBuilder<TResource>
Maps the endpoint port for the JavaScript.JavaScriptAppResource to the appropriate command line argument.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<TResource> WithMappedEndpointPort<TResource>(
this IResourceBuilder<TResource> builder,
string? endpointName = null)
{
// ...
}
}
builder IResourceBuilder<TResource> The Node.js app resource.
endpointName string? optional The name of the endpoint to map. If not specified, it will use the first HTTP or HTTPS endpoint found.
IResourceBuilder<TResource> A reference to the ApplicationModel.IResourceBuilder`1.
WithNpm(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) Section titled WithNpm(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) extension IResourceBuilder<NxResource>
Configures the Nx workspace to use npm as the package manager and optionally installs packages before apps start.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<NxResource> WithNpm(
this IResourceBuilder<NxResource> builder,
bool install = false,
Action<IResourceBuilder<JavaScriptInstallerResource>>? configureInstaller = null)
{
// ...
}
}
builder IResourceBuilder<NxResource> The Nx workspace resource builder.
install bool optional When true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstaller Action<IResourceBuilder<JavaScriptInstallerResource>> optional A function to configure the installer resource builder.
IResourceBuilder<NxResource> A reference to the ApplicationModel.IResourceBuilder`1.
WithNpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) Section titled WithNpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) extension IResourceBuilder<TurborepoResource>
Configures the Turborepo workspace to use npm as the package manager and optionally installs packages before apps start.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<TurborepoResource> WithNpm(
this IResourceBuilder<TurborepoResource> builder,
bool install = false,
Action<IResourceBuilder<JavaScriptInstallerResource>>? configureInstaller = null)
{
// ...
}
}
builder IResourceBuilder<TurborepoResource> The Turborepo workspace resource builder.
install bool optional When true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstaller Action<IResourceBuilder<JavaScriptInstallerResource>> optional A function to configure the installer resource builder.
IResourceBuilder<TurborepoResource> A reference to the ApplicationModel.IResourceBuilder`1.
WithPackageManagerLaunch(IResourceBuilder<NxResource>, string?) Section titled WithPackageManagerLaunch(IResourceBuilder<NxResource>, string?) extension IResourceBuilder<NxResource>
Configures the Nx workspace to use the specified JavaScript package manager when starting apps.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<NxResource> WithPackageManagerLaunch(
this IResourceBuilder<NxResource> builder,
string? packageManager = null)
{
// ...
}
}
builder IResourceBuilder<NxResource> The Nx workspace resource builder.
packageManager string? optional The package manager to use. If none is provided it will attempt to use the installer annotation's resource command.
IResourceBuilder<NxResource> A reference to the ApplicationModel.IResourceBuilder`1.
InvalidOperationException Thrown if the Nx workspace is already configured to use a different package manager.
WithPackageManagerLaunch(IResourceBuilder<TurborepoResource>, string?) Section titled WithPackageManagerLaunch(IResourceBuilder<TurborepoResource>, string?) extension IResourceBuilder<TurborepoResource>
Configures the Turborepo workspace to use the specified JavaScript package manager when starting apps.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<TurborepoResource> WithPackageManagerLaunch(
this IResourceBuilder<TurborepoResource> builder,
string? packageManager = null)
{
// ...
}
}
builder IResourceBuilder<TurborepoResource> The Turborepo workspace resource builder.
packageManager string? optional The package manager to use. If none is provided it will attempt to use the installer annotation's resource command.
IResourceBuilder<TurborepoResource> A reference to the ApplicationModel.IResourceBuilder`1.
InvalidOperationException Thrown if the Turborepo workspace is already configured to use a different package manager.
WithPnpm(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) Section titled WithPnpm(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) extension IResourceBuilder<NxResource>
Configures the Nx workspace to use pnpm as the package manager and optionally installs packages before apps start.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<NxResource> WithPnpm(
this IResourceBuilder<NxResource> builder,
bool install = false,
Action<IResourceBuilder<JavaScriptInstallerResource>>? configureInstaller = null)
{
// ...
}
}
builder IResourceBuilder<NxResource> The Nx workspace resource builder.
install bool optional When true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstaller Action<IResourceBuilder<JavaScriptInstallerResource>> optional A function to configure the installer resource builder.
IResourceBuilder<NxResource> A reference to the ApplicationModel.IResourceBuilder`1.
WithPnpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) Section titled WithPnpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) extension IResourceBuilder<TurborepoResource>
Configures the Turborepo workspace to use pnpm as the package manager and optionally installs packages before apps start.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<TurborepoResource> WithPnpm(
this IResourceBuilder<TurborepoResource> builder,
bool install = false,
Action<IResourceBuilder<JavaScriptInstallerResource>>? configureInstaller = null)
{
// ...
}
}
builder IResourceBuilder<TurborepoResource> The Turborepo workspace resource builder.
install bool optional When true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstaller Action<IResourceBuilder<JavaScriptInstallerResource>> optional A function to configure the installer resource builder.
IResourceBuilder<TurborepoResource> A reference to the ApplicationModel.IResourceBuilder`1.
WithYarn(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) Section titled WithYarn(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) extension IResourceBuilder<NxResource>
Configures the Nx workspace to use yarn as the package manager and optionally installs packages before apps start.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<NxResource> WithYarn(
this IResourceBuilder<NxResource> builder,
bool install = false,
Action<IResourceBuilder<JavaScriptInstallerResource>>? configureInstaller = null)
{
// ...
}
}
builder IResourceBuilder<NxResource> The Nx workspace resource builder.
install bool optional When true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstaller Action<IResourceBuilder<JavaScriptInstallerResource>> optional A function to configure the installer resource builder.
IResourceBuilder<NxResource> A reference to the ApplicationModel.IResourceBuilder`1.
WithYarn(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) Section titled WithYarn(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>) extension IResourceBuilder<TurborepoResource>
Configures the Turborepo workspace to use yarn as the package manager and optionally installs packages before apps start.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<TurborepoResource> WithYarn(
this IResourceBuilder<TurborepoResource> builder,
bool install = false,
Action<IResourceBuilder<JavaScriptInstallerResource>>? configureInstaller = null)
{
// ...
}
}
builder IResourceBuilder<TurborepoResource> The Turborepo workspace resource builder.
install bool optional When true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstaller Action<IResourceBuilder<JavaScriptInstallerResource>> optional A function to configure the installer resource builder.
IResourceBuilder<TurborepoResource> A reference to the ApplicationModel.IResourceBuilder`1.