DarkPatterns.ProxyDevelopmentServer
0.1.0
dotnet add package DarkPatterns.ProxyDevelopmentServer --version 0.1.0
NuGet\Install-Package DarkPatterns.ProxyDevelopmentServer -Version 0.1.0
<PackageReference Include="DarkPatterns.ProxyDevelopmentServer" Version="0.1.0" />
<PackageVersion Include="DarkPatterns.ProxyDevelopmentServer" Version="0.1.0" />
<PackageReference Include="DarkPatterns.ProxyDevelopmentServer" />
paket add DarkPatterns.ProxyDevelopmentServer --version 0.1.0
#r "nuget: DarkPatterns.ProxyDevelopmentServer, 0.1.0"
#:package DarkPatterns.ProxyDevelopmentServer@0.1.0
#addin nuget:?package=DarkPatterns.ProxyDevelopmentServer&version=0.1.0
#tool nuget:?package=DarkPatterns.ProxyDevelopmentServer&version=0.1.0
DarkPatterns.ProxyDevelopmentServer
A development server for use with .NET Spa Services. This works very similarly
to the UseReactDevelopmentServer middleware provided by the .NET Spa Services
project.
Note: This server is intended for development purposes only; it is not optimized for production.
Add your project reference to your csproj; be sure to exclude it for release builds:
<ItemGroup>
<PackageReference Include="DarkPatterns.ProxyDevelopmentServer" Version="0.1.0" Condition=" '$(Configuration)' == 'Debug' " />
</ItemGroup>
Usage example:
app.UseSpa(spa => {
#if DEBUG
if (env.IsDevelopment())
{
spa.Options.SourcePath = "./path-to-working-directory";
spa.UseProxyDevelopmentServer(DarkPatterns.ProxyDevelopmentServer.ProxyDevelopmentServerOptions.PnpmViteServer);
// or
spa.UseProxyDevelopmentServer(DarkPatterns.ProxyDevelopmentServer.ProxyDevelopmentServerOptions.DefaultViteServer);
// or
spa.UseProxyDevelopmentServer(new()
{
// fill in your own details
});
}
#endif
});
The fully-qualified namespace is provided so that the #if DEBUG does not need
to be added in the using statements.
spa.Options.SourcePathis the working directory (relative to your application's working directory) in which to run the proxy server.ProxyDevelopmentServerOptionshas a few default configurations:ProxyDevelopmentServerOptions.PnpmViteServerruns a Vite dev server via the PNPM command line.ProxyDevelopmentServerOptions.DefaultViteServerruns a Vite dev server via thenode_modules/.bin/vitepath.
If you have a setup that doesn't use one of the standard scenarios, you can set up your own configuration:
IsScriptFileindicates if the file being targeted is a script. If false, it is assumed that the command is on the path and does not need additional modification (on non-Windows machines, see below.)BaseCommandis the name of the executable or script to launch, such aspnpmornode_modules/.bin/vite.Parametersare the command-line arguments to be passed to the script. These should be already-escaped values and quoted as necessary.ReadyTextis the text to search for within the Standard Out of the command to know that the proxy is ready. This is parsed as a regular expression, and evaluated against each complete line returned from the command (prior to any filters).Timeoutis how long to expect to wait for theReadyText. If the timeout is exceeded, the application will not start. Note that this is used in conjunction with thespaBuilder.Options.StartupTimeout; if either times out before the proxy is ready, the application will not start.
See the demo and test projects for more usage details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.SpaServices.Extensions (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 272 | 10/30/2024 |