Error: Cannot find module './routes/rosemiracles'

1,590 views
Skip to first unread message

psychok7

unread,
May 3, 2012, 3:17:54 PM5/3/12
to expre...@googlegroups.com
hi, so im new to express.js and i am writing my app on top of the socket.io chat example.

i can get it to work, but i added a routes folder and put my rosemiracle.jade in it. not i get a  Error: Cannot find module './routes/rosemiracles'  i  but the file exists , why is this happening?

app.js : var routes = require('./routes/rosemiracles');


psychok7

unread,
May 3, 2012, 3:20:45 PM5/3/12
to expre...@googlegroups.com
this is also in my app.js :
app.get('/', routes.home);

in my miracles.jade i have :

exports.home = function(req, res){
  res.render('index', { layout: false });
};

psychok7

unread,
May 3, 2012, 3:22:37 PM5/3/12
to expre...@googlegroups.com
i should add that before the application didnt have a routes folder. i added by hand. i also did npm install routes and nothing


On Thursday, May 3, 2012 8:17:54 PM UTC+1, psychok7 wrote:

psychok7

unread,
May 3, 2012, 3:26:27 PM5/3/12
to expre...@googlegroups.com
forget it my bad. i gave the files the wrong extension


On Thursday, May 3, 2012 8:17:54 PM UTC+1, psychok7 wrote:

Ryan Schmidt

unread,
May 3, 2012, 3:45:44 PM5/3/12
to expre...@googlegroups.com
Right. The routes folder is for JavaScript code that defines your routes, so the file would need to be called routes/rosemiracles.js and contain JavaScript code, not a Jade template.
Reply all
Reply to author
Forward
0 new messages