-
-
Notifications
You must be signed in to change notification settings - Fork 34
Small tweaks to application setup #71
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
Small tweaks to application setup #71
Conversation
davidfowl
commented
Aug 8, 2021
- Close over WebApplicationBuilder for configuration and environment.
- Male explicit call to UseRouting so the error handler works
- Grouped middleware Use* before route Map*.
- Close over WebApplicationBuilder for configuration and environment. - Male explicit call to UseRouting so the error handler works - Grouped middleware Use* before route Map*.
- Enable nullable and removed a null check - Validate auth options on startup
Codecov Report
@@ Coverage Diff @@
## main #71 +/- ##
==========================================
+ Coverage 94.95% 94.96% +0.01%
==========================================
Files 17 17
Lines 317 318 +1
==========================================
+ Hits 301 302 +1
Misses 16 16
Continue to review full report at Codecov.
|
}); | ||
|
||
// Add user authentication with GitHub as an external OAuth provider | ||
builder.Services.AddGitHubAuthentication(); | ||
|
||
// Add Razor Pages to render the UI | ||
builder.Services.AddRazorPages(); | ||
builder.Services.AddRouting(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah did I mix up which one is implicit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep this is implicit
@@ -55,6 +55,7 @@ public static IServiceCollection AddGitHubAuthentication(this IServiceCollection | |||
options.ClaimActions.MapJsonKey(GitHubAvatarClaim, "avatar_url"); | |||
} | |||
}) | |||
.ValidateOnStart() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
Thanks! |
@@ -52,7 +52,7 @@ public static IEndpointRouteBuilder MapTodoApiRoutes(this IEndpointRouteBuilder | |||
ITodoService service, | |||
CancellationToken cancellationToken) => | |||
{ | |||
if (model is null || string.IsNullOrWhiteSpace(model.Text)) | |||
if (string.IsNullOrWhiteSpace(model.Text)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is new in rc1, we use the nullability of the parameter to determine if we should call your method with null. dotnet/aspnetcore#32375
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of nice little QoL and usability stuff coming in now 😎