thepeacockproject / Peacock

The Peacock Project is a HITMAN™ World of Assassination trilogy server replacement.
https://thepeacockproject.org
GNU Affero General Public License v3.0
367 stars 57 forks source link

Separate routing logic and business logic #352

Closed RDIL closed 8 months ago

RDIL commented 9 months ago

Fixes #337

LennardF1989 commented 8 months ago

I'll pull this in end-of-the-day and give it a checkup. Just to make sure I validate it accordingly: where does routing logic end in your opinion and where does business logic start? If I hear this, I would say the implementation of endpoints should only ever call other functions, that do stuff, and the only thing the endpoint does is return that or decide on the appropriate statuscode. Meaning that endpoint implementations are very small and compherensible functions to eventually return a response.

Is that how you see it, too?

RDIL commented 8 months ago

Yeah, that’s basically my philosophy. Endpoints only validate then call another function.

I tested this PR with Neko, all 3 game versions have no regressions.