1

I've dabbled in a few MVC frameworks (like Rails and its ilk) and I've noticed that the file that defines restful routes often go separate from controllers which hold the actions executed through those routes.

For example, let's say that there is a route

/users

That go to UserController.create action.

I would expect it to be defined as part of the controller but it is often defined in some

config/routes.rb|js file

Why is this?

  • You may have more than one routes that end up to the same controller. – yannis Feb 7 '16 at 9:50
  • Note that this isn't universal. E.g. Spring MVC, which defines routes using annotations on controller methods. – Jules Feb 7 '16 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.