Skip to content

Commit

Permalink
.NET Aspire Community Toolkit cleanup (#1806)
Browse files Browse the repository at this point in the history
* Initial clean up

* Edit pass

* Fix MD error
  • Loading branch information
IEvangelist authored Oct 10, 2024
1 parent 5487af0 commit e76fd22
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 98 deletions.
2 changes: 2 additions & 0 deletions docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@
},
"author": {
"docs/**/*.*": "IEvangelist",
"docs/community-toolkit/**/*.*": "aaronpowell",
"docs/database/**/*.*": "CamSoper",
"docs/storage/**/*.*": "CamSoper",
"docs/deployment/**/*.*": "CamSoper"
},
"ms.author": {
"docs/**/*.*": "dapine",
"docs/community-toolkit/**/*.*": "aapowell",
"docs/database/**/*.*": "casoper",
"docs/storage/**/*.*": "casoper",
"docs/deployment/**/*.*": "casoper"
Expand Down
18 changes: 11 additions & 7 deletions docs/community-toolkit/hosting-azure-static-web-apps.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
---
title: Azure Static Web Apps emulator
author: aaronpowell
description: A .NET Aspire hosting integration for the Azure Static Web Apps emulator.
description: Learn how to use the .NET Aspire Azure Static Web Apps emulator integration to run Azure Static Web Apps locally using the emulator.
ms.date: 10/11/2024
---

# .NET Aspire Azure Static Web Apps emulator integration

[!INCLUDE [includes-hosting](../includes/includes-hosting.md)]

[!INCLUDE [banner](includes/banner.md)]

In this article, you'll learn how to use the .NET Aspire [Azure Static Web Apps emulator](/azure/static-web-apps/local-development) integration to run Azure Static Web Apps locally using the emulator. The emulator provides support for proxying both the static frontend and the API backend using resources defined in the app host.
In this article, you learn how to use the .NET Aspire [Azure Static Web Apps emulator](/azure/static-web-apps/local-development) hosting integration to run Azure Static Web Apps locally using the emulator. The emulator provides support for proxying both the static frontend and the API backend using resources defined in the app host.

This integration requires the [Azure Static Web Apps CLI](/azure/static-web-apps/local-development#get-started) to run, and only supports hosting the emulator for local development, not deploying to Azure Static Web Apps.

## Getting Started
## Hosting integration

To get started with the .NET Aspire Azure Static Web Apps emulator integration, install the [Aspire.CommunityToolkit.Hosting.Azure.StaticWebApps](https://github.com/orgs/CommunityToolkit/packages/nuget/package/Aspire.CommunityToolkit.Hosting.Azure.StaticWebApps) NuGet package in the AppHost project.
To get started with the .NET Aspire Azure Static Web Apps emulator hosting integration, install the [📦 Aspire.CommunityToolkit.Hosting.Azure.StaticWebApps](https://github.com/orgs/CommunityToolkit/packages/nuget/package/Aspire.CommunityToolkit.Hosting.Azure.StaticWebApps) NuGet package in the AppHost project.

### [.NET CLI](#tab/dotnet-cli)

Expand All @@ -34,9 +35,9 @@ dotnet add package Aspire.CommunityToolkit.Hosting.Azure.StaticWebApps

For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-package) or [Manage package dependencies in .NET applications](/dotnet/core/tools/dependencies).

## Example Usage
## Example usage

In the _::no-loc text="Program.cs"_ file of your AppHost project, define the backend and frontend resources and call the `AddSwaEmulator` method to create the emulator, and pass the resources using the `WithAppResource` and `WithApiResource` methods.
In the _:::no-loc text="Program.cs":::_ file of your app host project, define the backend and frontend resources. Then, call the `AddSwaEmulator` method to create the emulator and pass the resources using the `WithAppResource` and `WithApiResource` methods.

```csharp
var builder = DistributedApplication.CreateBuilder(args);
Expand All @@ -59,8 +60,11 @@ _ = builder
builder.Build().Run();
```

The preceding code defines the API and frontend resources and creates an emulator with the resources. The emulator is then started using the `Run` method.

## See also

- [Azure Static Web Apps emulator](/azure/static-web-apps/local-development)
- [Azure Static Web Apps](/azure/static-web-apps/)
- [.NET Aspire Community Toolkit GitHub repo](https://github.com/CommunityToolkit/Aspire)
- [Sample app source code](https://github.com/CommunityToolkit/Aspire/tree/main/examples/swa)
11 changes: 7 additions & 4 deletions docs/community-toolkit/hosting-golang.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
---
title: Go hosting
author: tommasodotNET
description: A .NET Aspire hosting integration for Go apps.
description: Learn how to use the .NET Aspire Go hosting integration to host Go applications.
ms.date: 10/11/2024
---

# .NET Aspire Go hosting

[!INCLUDE [includes-hosting](../includes/includes-hosting.md)]

[!INCLUDE [banner](includes/banner.md)]

In this article, you'll learn how to use the .NET Aspire Go hosting integration to host Go applications.
In this article, you learn how to use the .NET Aspire Go hosting integration to host Go applications.

## Getting Started
## Hosting integration

To get started with the .NET Aspire Go hosting integration, install the [Aspire.CommunityToolkit.Hosting.Go](https://github.com/orgs/CommunityToolkit/packages/nuget/package/Aspire.CommunityToolkit.Hosting.Golang) NuGet package in the AppHost project.
To get started with the .NET Aspire Go hosting integration, install the [📦 Aspire.CommunityToolkit.Hosting.Go](https://github.com/orgs/CommunityToolkit/packages/nuget/package/Aspire.CommunityToolkit.Hosting.Golang) NuGet package in the AppHost project.

### [.NET CLI](#tab/dotnet-cli)

Expand Down Expand Up @@ -45,3 +47,4 @@ The Go application can be added as a reference to other resources in the AppHost
## See also

- [.NET Aspire Community Toolkit GitHub repo](https://github.com/CommunityToolkit/Aspire)
- [Sample Go app](https://github.com/CommunityToolkit/Aspire/tree/main/examples/golang)
38 changes: 22 additions & 16 deletions docs/community-toolkit/hosting-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ ms.date: 10/11/2024

# .NET Aspire Java/Spring hosting integration

[!INCLUDE [includes-hosting](../includes/includes-hosting.md)]

[!INCLUDE [banner](includes/banner.md)]

In this article, you'll learn how to use the .NET Aspire Java/Spring hosting integration to host Java/Spring applications using either the Java runtime or a container.
In this article, you learn how to use the .NET Aspire Java/Spring hosting integration to host Java/Spring applications using either the Java runtime or a container.

## Prerequisites

Expand All @@ -36,9 +38,9 @@ Invoke-WebRequest `

---

## Getting Started
## Get started

To get started with the .NET Aspire Azure Static Web Apps emulator integration, install the [Aspire.CommunityToolkit.Hosting.Java](https://github.com/orgs/CommunityToolkit/packages/nuget/package/Aspire.CommunityToolkit.Hosting.Java) NuGet package in the AppHost project.
To get started with the .NET Aspire Azure Static Web Apps emulator integration, install the [📦 Aspire.CommunityToolkit.Hosting.Java](https://github.com/orgs/CommunityToolkit/packages/nuget/package/Aspire.CommunityToolkit.Hosting.Java) NuGet package in the AppHost project.

### [.NET CLI](#tab/dotnet-cli)

Expand All @@ -59,30 +61,34 @@ For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-pac

## Example Usage

The following sections detail various example usage scenarios, from hosting a containerized Spring app to hosting an executable Spring app.

### [Container hosting](#tab/container-hosting)

In the _:::no-loc text="Program.cs":::_file of your app host project, call the `AddSpringApp` method to define the containerized Spring app. Use the `JavaAppContainerResourceOptions` to define the containerized Spring app.

```csharp
var containerapp = builder.AddSpringApp("containerapp",
new JavaAppContainerResourceOptions()
{
ContainerImageName = "<repository>/<image>",
OtelAgentPath = "<agent-path>"
});
var containerapp = builder.AddSpringApp(
"containerapp",
new JavaAppContainerResourceOptions
{
ContainerImageName = "<repository>/<image>",
OtelAgentPath = "<agent-path>"
});
```

### [Executable hosting](#tab/executable-hosting)

In the _::no-loc text="Program.cs"_ file of your AppHost project, call the `AddSpringApp` method to define the executable Spring app. Use the `JavaAppExecutableResourceOptions` to define the executable Spring app.
In the _:::no-loc text="Program.cs":::_ file of your AppHost project, call the `AddSpringApp` method to define the executable Spring app. Use the `JavaAppExecutableResourceOptions` to define the executable Spring app.

```csharp
var executableapp = builder.AddSpringApp("executableapp",
new JavaAppExecutableResourceOptions()
{
ApplicationName = "target/app.jar",
OtelAgentPath = "../../../agents"
});
var executableapp = builder.AddSpringApp(
"executableapp",
new JavaAppExecutableResourceOptions
{
ApplicationName = "target/app.jar",
OtelAgentPath = "../../../agents"
});
```

---
Expand Down
34 changes: 20 additions & 14 deletions docs/community-toolkit/hosting-nodejs-extensions.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
---
title: Node.js hosting extensions
author: aaronpowell
description: Extensions on the .NET Aspire hosting for Node.js applications to support alternative package managers.
description: Learn about the .NET Aspire Community Toolkit Node.js hosting extensions package which provides extra functionality to the .NET Aspire NodeJS hosting package.
ms.date: 10/11/2024
---

# .NET Aspire Community Toolkit Node.js hosting extensions

[!INCLUDE [includes-hosting](../includes/includes-hosting.md)]

[!INCLUDE [banner](includes/banner.md)]

In this article, you'll learn about the .NET Aspire Community Toolkit Node.js hosting extensions package which provides additional functionality to the .NET Aspire [NodeJS hosting package](https://nuget.org/packages/Aspire.Hosting.NodeJS). The extensions package brings the following features:
In this article, you learn about the .NET Aspire Community Toolkit Node.js hosting extensions package which provides extra functionality to the .NET Aspire [NodeJS hosting package](https://nuget.org/packages/Aspire.Hosting.NodeJS). The extensions package brings the following features:

- Running [Vite](https://vitejs.dev/) applications
- Running Node.js applications using [Yarn](https://yarnpkg.com/) and [pnpm](https://pnpm.io/)
- Ensuring that the packages are installed before running the application (using the specified package manager)

## Get started
## Hosting integration

To get started with the .NET Aspire Community Toolkit Node.js hosting extensions, install the [Aspire.CommunityToolkit.Hosting.NodeJS.Extensions](https://github.com/orgs/CommunityToolkit/packages/nuget/package/Aspire.CommunityToolkit.Hosting.NodeJS.Extensions) NuGet package in the AppHost project.
To get started with the .NET Aspire Community Toolkit Node.js hosting extensions, install the [📦 Aspire.CommunityToolkit.Hosting.NodeJS.Extensions](https://github.com/orgs/CommunityToolkit/packages/nuget/package/Aspire.CommunityToolkit.Hosting.NodeJS.Extensions) NuGet package in the AppHost project.

### [.NET CLI](#tab/dotnet-cli)

Expand All @@ -34,9 +35,13 @@ dotnet add package Aspire.CommunityToolkit.Hosting.NodeJS.Extensions

---

For more information, see [dotnet add package](/dotnet/core/tools/dotnet-add-package) or [Manage package dependencies in .NET applications](/dotnet/core/tools/dependencies).

## Example usage

### Running with a specific package manager
The following sections detail various usages, from running Vite applications to using specific package managers.

### Run specific package managers

This integration extension adds support for running Node.js applications using Yarn or pnpm as the package manager.

Expand All @@ -46,7 +51,7 @@ This integration extension adds support for running Node.js applications using Y
var builder = DistributedApplication.CreateBuilder(args);

builder.AddYarnApp("yarn-demo")
.WithExternalHttpEndpoints();
.WithExternalHttpEndpoints();
```

# [pnpm](#tab/pnpm)
Expand All @@ -55,35 +60,36 @@ builder.AddYarnApp("yarn-demo")
var builder = DistributedApplication.CreateBuilder(args);

builder.AddPnpmApp("pnpm-demo")
.WithExternalHttpEndpoints();
.WithExternalHttpEndpoints();
```

---

### Running Vite applications
### Run Vite apps

This integration extension adds support for running the development server for Vite applications. By default, it will use the `npm` package manager to launch, but this can be overridden with the `packageManager` argument.
This integration extension adds support for running the development server for Vite applications. By default, it uses the `npm` package manager to launch, but this can be overridden with the `packageManager` argument.

```csharp
var builder = DistributedApplication.CreateBuilder(args);

builder.AddViteApp("vite-demo")
.WithExternalHttpEndpoints();
.WithExternalHttpEndpoints();

builder.AddViteApp("yarn-demo", packageManager: "yarn")
.WithExternalHttpEndpoints();
.WithExternalHttpEndpoints();

builder.AddViteApp("pnpm-demo", packageManager: "pnpm")
.WithExternalHttpEndpoints();
.WithExternalHttpEndpoints();

builder.Build().Run();
```

### Install packages

When using the `WithNpmPackageInstallation`, `WithYarnPackageInstallation` or `WithPnpmPackageInstallation` methods, the package manager will be used to install the packages before starting the application. This is useful to ensure that packages are installed before the application starts, similar to how a .NET application would restore NuGet packages before running.
When using the `WithNpmPackageInstallation`, `WithYarnPackageInstallation` or `WithPnpmPackageInstallation` methods, the package manager is used to install the packages before starting the application. These methods are useful to ensure that packages are installed before the application starts, similar to how a .NET application would restore NuGet packages before running.

## See also

- [Orchestrate Node.js apps in .NET Aspire](../get-started/build-aspire-apps-with-nodejs.md)
- [.NET Aspire Community Toolkit GitHub repo](https://github.com/CommunityToolkit/Aspire)
- [Sample Node.js apps](https://github.com/CommunityToolkit/Aspire/tree/main/examples/nodejs-ext)
6 changes: 5 additions & 1 deletion docs/community-toolkit/includes/banner.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
---
ms.topic: include
---

> [!NOTE]
> This integration is part of the [.NET Aspire Community Toolkit](https://github.com/CommunityToolkit/Aspire) and not officially supported by the .NET Aspire team.
> This integration is part of the [.NET Aspire Community Toolkit](https://github.com/CommunityToolkit/Aspire) and _isn't_ officially supported by the .NET Aspire team.
Loading

0 comments on commit e76fd22

Please sign in to comment.