Service or controller

I am trying to work out what is the best way to determine when to use controllers and when to use services.

I have searched online and can find plenty of pages explaining the difference but none that ever say when one is better than the other.

As an example I have a controller that allows me to send emails and I have the exact same code in a service. Both work but how to choose which way to go? Personally I find services easier to debug but since I’m a journeyman coder that doesn’t exactly answer the deeper question.

Is there a difference in performance eg the processing overhead?

Please could someone explain the pros and cons to each or is it simply personal choice?


1 Like

Controllers usually are used in WASM applications or when you need something that requires full navigation, like downloading large file (our export controller), login a user, etc.