C
C#•3y ago
tommy

Project structure (MVC API, microservice arch.)

19 Replies
tommy
tommyOP•3y 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•3y ago
that repo doesn't exist
tommy
tommyOP•3y ago
hold on yea it's private 😭 @Jimmacle try now
Angius
Angius•3y 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
tommy
tommyOP•3y ago
Is this a C# specific idiom?
Angius
Angius•3y 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?
tommy
tommyOP•3y 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•3y ago
For learning on the spot, it looks really good
tommy
tommyOP•3y 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•3y ago
Well it's definitely not microservice-based lol
tommy
tommyOP•3y 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•3y 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
tommy
tommyOP•3y 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•3y ago
Yep All synchronized with some message queue, for example If need be
tommy
tommyOP•3y ago
is it too late to do this? How would i structure a project like that folder wise?
Angius
Angius•3y ago
¯\_(ツ)_/¯ I never worked with microservices Never intend to, really
tommy
tommyOP•3y ago
Me too, tbh i think the whole MicroService thing is a hypetrain that will derail anytime soon
tommy
tommyOP•3y ago
I'll have to trash this as well i guess as each micro service would have its own db
No description
Angius
Angius•3y 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

Did you find this page helpful?