Skip to content

Commit 853fed4

Browse files
🐛 Fixes #1282 exclude razor pages from api only template
1 parent 36373b2 commit 853fed4

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

.template.config/template.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"generator": "constant",
2525
"replaces": "caPackageVersion",
2626
"parameters": {
27-
"value": "9.0.5"
27+
"value": "9.0.6"
2828
}
2929
},
3030
"caRepositoryUrl": {
@@ -194,6 +194,7 @@
194194
"exclude": [
195195
"src/Web/ClientApp/**",
196196
"src/Web/ClientApp-React/**",
197+
"src/Web/Pages/**",
197198
"src/Web/Templates/**",
198199
"src/Web/config.nswag",
199200
"src/Web/config-react.nswag",

CleanArchitecture.nuspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<metadata>
44

55
<id>Clean.Architecture.Solution.Template</id>
6-
<version>9.0.5</version>
6+
<version>9.0.6</version>
77
<title>Clean Architecture Solution Template</title>
88
<authors>JasonTaylorDev</authors>
99
<description>Clean Architecture Solution Template for .NET 9.</description>
1010
<summary>
1111
A Clean Architecture Solution Template for creating apps using Angular, React, or Web API only with ASP.NET Core.
1212
</summary>
1313
<releaseNotes>
14-
✨ Add support for PostgreSQL
14+
🐛 Exclude Razer Pages from API template.
1515
</releaseNotes>
1616

1717
<projectUrl>https://github.com/JasonTaylorDev/CleanArchitecture</projectUrl>

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The following prerequisites are required to build and run the solution:
1919

2020
The easiest way to get started is to install the [.NET template](https://www.nuget.org/packages/Clean.Architecture.Solution.Template):
2121
```
22-
dotnet new install Clean.Architecture.Solution.Template::9.0.5
22+
dotnet new install Clean.Architecture.Solution.Template::9.0.6
2323
```
2424

2525
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:

src/Web/DependencyInjection.cs

+2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public static void AddWebServices(this IHostApplicationBuilder builder)
2727

2828
builder.Services.AddExceptionHandler<CustomExceptionHandler>();
2929

30+
#if (!UseApiOnly)
3031
builder.Services.AddRazorPages();
32+
#endif
3133

3234
// Customise default API behaviour
3335
builder.Services.Configure<ApiBehaviorOptions>(options =>

src/Web/Program.cs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using CleanArchitecture.Infrastructure.Data;
22

33
var builder = WebApplication.CreateBuilder(args);
4-
4+
55
// Add services to the container.
66
#if (UseAspire)
77
builder.AddServiceDefaults();
@@ -24,8 +24,8 @@
2424
app.UseHsts();
2525
}
2626

27-
#if (!UseAspire)
28-
app.UseHealthChecks("/health");
27+
#if (!UseAspire)
28+
app.UseHealthChecks("/health");
2929
#endif
3030
app.UseHttpsRedirection();
3131
app.UseStaticFiles();
@@ -36,13 +36,11 @@
3636
settings.DocumentPath = "/api/specification.json";
3737
});
3838

39-
app.MapControllerRoute(
40-
name: "default",
41-
pattern: "{controller}/{action=Index}/{id?}");
42-
39+
#if (!UseApiOnly)
4340
app.MapRazorPages();
4441

4542
app.MapFallbackToFile("index.html");
43+
#endif
4644

4745
app.UseExceptionHandler(options => { });
4846

0 commit comments

Comments
 (0)