C
C#•7mo ago
thomas

Project structure (MVC API, microservice arch.)

19 Replies
thomas
thomas•7mo ago
I'd like to know if the folder structure looks good here and if it make sense the i split each controller/service
Jimmacle
Jimmacle•7mo ago
that repo doesn't exist
thomas
thomas•7mo ago
hold on yea it's private 😭 @Jimmacle try now
Angius
Angius•7mo ago
I'd certainly utilize the global exception handler instead of writing the try..catch...return 500 manually in each action Nice services, I like that you're not falling for the generic repo trap here Although I'd definitely utilize asynchronous code Far as the structure itself goes, it seems pefectly fine
thomas
thomas•7mo ago
Is this a C# specific idiom?
Angius
Angius•7mo ago
ASP-specific one, I'd say Exception handling middleware already exists, it already returns an error 500 whenever an exception occurs Why not use it?
thomas
thomas•7mo ago
(i'm kinda learning c# on the spot mixing Rust experience and some little java i learnt at uni, so yh i might not know about specific patterns)
Angius
Angius•7mo ago
For learning on the spot, it looks really good
thomas
thomas•7mo ago
Yeah im literally picking up C# as im writing this project (should be a microservice based app). I have to be fair, the syntax is quite similar to Java and C++ so its not very complicated.
Angius
Angius•7mo ago
Well it's definitely not microservice-based lol
thomas
thomas•7mo ago
I had some issues with entity framework while configuring the relationships at the beginning. Having a service folder with multiple services in it doesn't qualify as microservice? 😭
Angius
Angius•7mo ago
'Fraid not Microservice architecture is based on, well, micro services You have a separate app, basically, that just deals with users And another separate one that just deals with books They can connect to the same database, but run completely separately So that you can, for example, hot-swap a given microservice without affecting others /books might have downtime as you're updating it to version 1.1, but user registration and login still works because it still runs on /user Orelans is the .NET microserfvice framework
thomas
thomas•7mo ago
This def came across while googling but i'm afraid i can't use this as its a uni project (i have to follow certain specs) ASP.Net Core + EF + Docker + K8s pretty much that So multiple executables?
Angius
Angius•7mo ago
Yep All synchronized with some message queue, for example If need be
thomas
thomas•7mo ago
is it too late to do this? How would i structure a project like that folder wise?
Angius
Angius•7mo ago
¯\_(ツ)_/¯ I never worked with microservices Never intend to, really
thomas
thomas•7mo ago
Me too, tbh i think the whole MicroService thing is a hypetrain that will derail anytime soon
thomas
thomas•7mo ago
I'll have to trash this as well i guess as each micro service would have its own db
No description
Angius
Angius•7mo ago
Why? I mean, I guess each microservice can have its own db But does it have to? Idk tbh Change the title of this post to ask for help with microservices, maybe you'll attract people more in the know with it lol