Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fixes #1282 exclude razor pages from api only template #1283

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"generator": "constant",
"replaces": "caPackageVersion",
"parameters": {
"value": "9.0.5"
"value": "9.0.6"
}
},
"caRepositoryUrl": {
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions CleanArchitecture.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<metadata>

<id>Clean.Architecture.Solution.Template</id>
<version>9.0.5</version>
<version>9.0.6</version>
<title>Clean Architecture Solution Template</title>
<authors>JasonTaylorDev</authors>
<description>Clean Architecture Solution Template for .NET 9.</description>
<summary>
A Clean Architecture Solution Template for creating apps using Angular, React, or Web API only with ASP.NET Core.
</summary>
<releaseNotes>
✨ Add support for PostgreSQL
🐛 Exclude Razer Pages from API template.
</releaseNotes>

<projectUrl>https://github.com/JasonTaylorDev/CleanArchitecture</projectUrl>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions src/Web/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public static void AddWebServices(this IHostApplicationBuilder builder)

builder.Services.AddExceptionHandler<CustomExceptionHandler>();

#if (!UseApiOnly)
builder.Services.AddRazorPages();
#endif

// Customise default API behaviour
builder.Services.Configure<ApiBehaviorOptions>(options =>
Expand Down
12 changes: 5 additions & 7 deletions src/Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using CleanArchitecture.Infrastructure.Data;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
#if (UseAspire)
builder.AddServiceDefaults();
Expand All @@ -24,8 +24,8 @@
app.UseHsts();
}

#if (!UseAspire)
app.UseHealthChecks("/health");
#if (!UseAspire)
app.UseHealthChecks("/health");
#endif
app.UseHttpsRedirection();
app.UseStaticFiles();
Expand All @@ -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 => { });

Expand Down
Loading