1602 / compound

MVC framework. Built on Node.JS. Works on server and browser.
http://compoundjs.com
1.6k stars 183 forks source link

Noeval scaffolding gives 500 error. #609

Closed incutonez closed 10 years ago

incutonez commented 10 years ago

I've tried scaffolding a noeval controller, and it appears it does not work. I get a 500 Error: Cannot find module './application'. I have now tried this on both my Mac and Windows machines. I'm not entirely sure what application should be as well... I tried linking to the application_controller, but then I get an error about before not existing, which I'm assuming is because I'm trying to load an eval controller in a noeval controller. Do I need to create a noeval application controller as well, or are there extra steps that I need to complete before running a noeval controller?

The steps to reproduce are simple:

compound init test
cd test
npm install
compound g c mytest --noeval
node .

Then browsing to 0.0.0.0:3000/mytests gives the Express error page.

anatoliychakkaev commented 10 years ago

Thanks for so detailed explanation! It really helps to reproduce your case in just 15 seconds. Lovely.

So, the problem in first command: "compound init test" should be "compound init test --noeval", in that case proper application controller will be created:

~: ) cat test/app/controllers/application.js
var Application = module.exports = function Application(init) {
    init.before(function protectFromForgeryHook(ctl) {
        ctl.protectFromForgery('882ca1302448261e2e49c3805f59c69a36299dbe');
    });
};

You can just remove your app/controllers/application_controller.js with app/controllers/application.js with code shown above.

Cheers!

incutonez commented 10 years ago

Ah! What a dumb mistake. Thanks so much for the super quick reply!