EntitiesUsers With Comments Project - API Implementation

When I started to refactor the comments feature, I realized I had the same code on multiple razor pages. I developed Comments, MemberProfile, and ProfileImage ApiControllers to consolidate the code. Adding support for ApiControllers is not difficult for an existing razor pages project. The UWCP also implements the Swashbuckle.AspNetCore Nuget package.

Add the controllers and Swagger services to the WebApplicationBuilder in Program.cs.

// API Support
builder.Services.AddControllers();
builder.Services.AddSwaggerGen();

Map endpoints for controllers and add Swagger middleware to the request pipeline in Program.cs.

// API Support
app.MapControllers();
app.UseSwagger();
app.UseSwaggerUI();
More Online: ASP.NET Core 6.0 - API Implementation

Comments(0)

Loading...
Loading...

Not accepting new comments.

Submit your comment. Comments are moderated.

User Image
DisplayedName - Member Since ?