-
Notifications
You must be signed in to change notification settings - Fork 10
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
Server stats #133
Server stats #133
Conversation
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.
see comments
MatchmakingServer/Program.cs
Outdated
@@ -199,4 +199,21 @@ [new Claim(ClaimTypes.Name, playerName), | |||
return Results.SignIn(claimsPrincipal); | |||
}); | |||
|
|||
app.MapGet("/stats", (PlayerStore playerStore, ServerStore serverStore, PartyService partyService, Matchmaker matchmaker) => |
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.
I feel like the Program.cs file is getting quite lengthy.
It might be time to clean it up and extract how services are set up and how the app is build.
Furthermore, I if an endpoint changes or w/e, you shouldn't have to change the program.cs file.
I recommend to just make a controller for http request maps. It is just a bit better separation. (imo)
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.
Yeah we should definetely clean it up, same for the App.xaml.cs
. I will create an issue for that, maybe i can clean it up as part of the multi-game refactoring.
I do like minimal api though it is more performant and... minimal :D So for single endpoints i think it makes sense. Would you be fine with putting them into seperate extension methods / classes?
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.
But isn't that just the same as adding a controller class? xD
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.
I see what you mean :D at first glance it looks the same but you dont have the slow controller pipeline and everything is more ✨ functional ✨. You only get the dependencies you need for that single endpoint.
Check out this example or REPR
. There is this new trend towards vertical slice architecture. Not saying we should necessarily use that, but it definetely has advantages
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.
Can't you make it like that example? That would be nice. And it is out of the program cs
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.
Yes will do that. Also a good time to add some validation to the login endpoint
Clean up 'Program.cs' a bit Fix matchmaking namespace
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.
Looks good! I like the FluentValidation too! I always used that :)
No description provided.