diff --git a/.template.config/template.json b/.template.config/template.json index 34a9eb2b6..008b09a5e 100644 --- a/.template.config/template.json +++ b/.template.config/template.json @@ -24,7 +24,7 @@ "generator": "constant", "replaces": "caPackageVersion", "parameters": { - "value": "9.0.5" + "value": "9.0.6" } }, "caRepositoryUrl": { @@ -194,6 +194,7 @@ "exclude": [ "src/Web/ClientApp/**", "src/Web/ClientApp-React/**", + "src/Web/Pages/**", "src/Web/Templates/**", "src/Web/config.nswag", "src/Web/config-react.nswag", diff --git a/CleanArchitecture.nuspec b/CleanArchitecture.nuspec index 22c86ba52..433132b8f 100644 --- a/CleanArchitecture.nuspec +++ b/CleanArchitecture.nuspec @@ -3,7 +3,7 @@ Clean.Architecture.Solution.Template - 9.0.5 + 9.0.6 Clean Architecture Solution Template JasonTaylorDev Clean Architecture Solution Template for .NET 9. @@ -11,7 +11,7 @@ A Clean Architecture Solution Template for creating apps using Angular, React, or Web API only with ASP.NET Core. - ✨ Add support for PostgreSQL + 🐛 Exclude Razer Pages from API template. https://github.com/JasonTaylorDev/CleanArchitecture diff --git a/README.md b/README.md index 742187bfc..5dae39161 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The following prerequisites are required to build and run the solution: The easiest way to get started is to install the [.NET template](https://www.nuget.org/packages/Clean.Architecture.Solution.Template): ``` -dotnet new install Clean.Architecture.Solution.Template::9.0.5 +dotnet new install Clean.Architecture.Solution.Template::9.0.6 ``` Once installed, create a new solution using the template. You can choose to use Angular, React, or create a Web API-only solution. Specify the client framework using the `-cf` or `--client-framework` option, and provide the output directory where your project will be created. Here are some examples: diff --git a/src/Web/DependencyInjection.cs b/src/Web/DependencyInjection.cs index 280d9c284..afb948896 100644 --- a/src/Web/DependencyInjection.cs +++ b/src/Web/DependencyInjection.cs @@ -27,7 +27,9 @@ public static void AddWebServices(this IHostApplicationBuilder builder) builder.Services.AddExceptionHandler(); +#if (!UseApiOnly) builder.Services.AddRazorPages(); +#endif // Customise default API behaviour builder.Services.Configure(options => diff --git a/src/Web/Program.cs b/src/Web/Program.cs index 88d99954f..a8281cb27 100644 --- a/src/Web/Program.cs +++ b/src/Web/Program.cs @@ -1,7 +1,7 @@ using CleanArchitecture.Infrastructure.Data; var builder = WebApplication.CreateBuilder(args); - + // Add services to the container. #if (UseAspire) builder.AddServiceDefaults(); @@ -24,8 +24,8 @@ app.UseHsts(); } -#if (!UseAspire) -app.UseHealthChecks("/health"); +#if (!UseAspire) +app.UseHealthChecks("/health"); #endif app.UseHttpsRedirection(); app.UseStaticFiles(); @@ -36,13 +36,11 @@ settings.DocumentPath = "/api/specification.json"; }); -app.MapControllerRoute( - name: "default", - pattern: "{controller}/{action=Index}/{id?}"); - +#if (!UseApiOnly) app.MapRazorPages(); app.MapFallbackToFile("index.html"); +#endif app.UseExceptionHandler(options => { });