Skip to content
DocsTry Aspire
DocsTry

JavaScriptHostingExtensions Methods

ClassMethods15 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>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<NxResource>The Nx workspace resource builder.
namestringThe name of the app resource.
appNamestring?optionalThe Nx app name to run. If not specified, uses the name.
configureFunc<IResourceBuilder<NxAppResource>, IResourceBuilder<NxAppResource>>optionalA function to configure the app resource builder.
IResourceBuilder<NxAppResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.AddNxWorkspaceApp instead.
AddApp(IResourceBuilder<TurborepoResource>, string, string?, Func<IResourceBuilder<TurborepoAppResource>, IResourceBuilder<TurborepoAppResource>>)Section titled AddApp(IResourceBuilder<TurborepoResource>, string, string?, Func<IResourceBuilder<TurborepoAppResource>, IResourceBuilder<TurborepoAppResource>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<TurborepoResource>The Turborepo workspace resource builder.
namestringThe name of the app resource.
filterstring?optionalThe Turborepo filter to use. If not specified, uses the name.
configureFunc<IResourceBuilder<TurborepoAppResource>, IResourceBuilder<TurborepoAppResource>>optionalA function to configure the app resource builder.
IResourceBuilder<TurborepoAppResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.AddTurborepoWorkspaceApp instead.
AddNxApp(IDistributedApplicationBuilder, string, string?)Section titled AddNxApp(IDistributedApplicationBuilder, string, string?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder to add the resource to.
namestringThe name of the Nx workspace resource.
workingDirectorystring?optionalThe 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?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder to add the resource to.
namestringThe name of the Turborepo workspace resource.
workingDirectorystring?optionalThe 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.
WithBun(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)Section titled WithBun(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)extensionIResourceBuilder<NxResource>
Configures the Nx workspace to use bun as the package manager and optionally installs packages before apps start.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<NxResource> WithBun(
this IResourceBuilder<NxResource> builder,
bool install = false,
Action<IResourceBuilder<JavaScriptInstallerResource>>? configureInstaller = null)
{
// ...
}
}
builderIResourceBuilder<NxResource>The Nx workspace resource builder.
installbooloptionalWhen true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstallerAction<IResourceBuilder<JavaScriptInstallerResource>>optionalA function to configure the installer resource builder.
IResourceBuilder<NxResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.WithNxBun instead.
WithBun(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)Section titled WithBun(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)extensionIResourceBuilder<TurborepoResource>
Configures the Turborepo workspace to use bun as the package manager and optionally installs packages before apps start.
public static class JavaScriptHostingExtensions
{
public static IResourceBuilder<TurborepoResource> WithBun(
this IResourceBuilder<TurborepoResource> builder,
bool install = false,
Action<IResourceBuilder<JavaScriptInstallerResource>>? configureInstaller = null)
{
// ...
}
}
builderIResourceBuilder<TurborepoResource>The Turborepo workspace resource builder.
installbooloptionalWhen true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstallerAction<IResourceBuilder<JavaScriptInstallerResource>>optionalA function to configure the installer resource builder.
IResourceBuilder<TurborepoResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.WithTurborepoBun instead.
WithMappedEndpointPort(IResourceBuilder<TResource>, string?)Section titled WithMappedEndpointPort(IResourceBuilder<TResource>, string?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<TResource>The Node.js app resource.
endpointNamestring?optionalThe 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>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<NxResource>The Nx workspace resource builder.
installbooloptionalWhen true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstallerAction<IResourceBuilder<JavaScriptInstallerResource>>optionalA function to configure the installer resource builder.
IResourceBuilder<NxResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.WithNxNpm instead.
WithNpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)Section titled WithNpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<TurborepoResource>The Turborepo workspace resource builder.
installbooloptionalWhen true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstallerAction<IResourceBuilder<JavaScriptInstallerResource>>optionalA function to configure the installer resource builder.
IResourceBuilder<TurborepoResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.WithTurborepoNpm instead.
WithPackageManagerLaunch(IResourceBuilder<NxResource>, string?)Section titled WithPackageManagerLaunch(IResourceBuilder<NxResource>, string?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<NxResource>The Nx workspace resource builder.
packageManagerstring?optionalThe 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.
InvalidOperationExceptionThrown if the Nx workspace is already configured to use a different package manager.
WithPackageManagerLaunch(IResourceBuilder<TurborepoResource>, string?)Section titled WithPackageManagerLaunch(IResourceBuilder<TurborepoResource>, string?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<TurborepoResource>The Turborepo workspace resource builder.
packageManagerstring?optionalThe 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.
InvalidOperationExceptionThrown 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>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<NxResource>The Nx workspace resource builder.
installbooloptionalWhen true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstallerAction<IResourceBuilder<JavaScriptInstallerResource>>optionalA function to configure the installer resource builder.
IResourceBuilder<NxResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.WithNxPnpm instead.
WithPnpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)Section titled WithPnpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<TurborepoResource>The Turborepo workspace resource builder.
installbooloptionalWhen true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstallerAction<IResourceBuilder<JavaScriptInstallerResource>>optionalA function to configure the installer resource builder.
IResourceBuilder<TurborepoResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.WithTurborepoPnpm instead.
WithYarn(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)Section titled WithYarn(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<NxResource>The Nx workspace resource builder.
installbooloptionalWhen true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstallerAction<IResourceBuilder<JavaScriptInstallerResource>>optionalA function to configure the installer resource builder.
IResourceBuilder<NxResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.WithNxYarn instead.
WithYarn(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)Section titled WithYarn(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<TurborepoResource>The Turborepo workspace resource builder.
installbooloptionalWhen true, automatically installs packages before apps start. When false (default), only sets the package manager annotation without creating an installer resource.
configureInstallerAction<IResourceBuilder<JavaScriptInstallerResource>>optionalA function to configure the installer resource builder.
IResourceBuilder<TurborepoResource>A reference to the ApplicationModel.IResourceBuilder`1.
This overload is not available in polyglot app hosts. Use JavaScriptHostingExtensions.WithTurborepoYarn instead.