Search code examples
node.jsmojito

Why in Mojito, renaming controller.server.js to controller.server-foo.js will have no effect?


In Mojito on top of Node.js, I followed the example on http://developer.yahoo.com/cocktails/mojito/docs/quickstart/

What I did was renaming controller.server.js to controller.server-foo.js, and created a new file controller.server.js to show "Hello World".

But when mojito is started, the old file controller.server-foo.js is being used and so the "Hello World" is not printed. How come Mojito will use the old file?

(I also tried renaming controller.server-foo.js to foo-controller.server.js and now the "Hello World" is printed, but why is controller.server-foo.js used?)


Solution

  • I found out that historically, the "affinity" of the controller can be two parts. The first part is common, server, or client, and the second part is optional, and it might be tests, or other words, so use other names such as controller-not-used-server.js to disable it.