The thing is. the "app" folder is where my node's logic sits and there you can find the views folder, with templates for handlebars (express-handlebars).
On the "config" folder, there's an express.js file where express package is actually required and also where I set the app engine and variables:
line 1: app.engine('handlebars', handlebars.engine);
line 2: app.set('views', path.join(__dirname, '../app/views');
line 3: app.set('view engine', 'handlebars');
The server.js file requires the express.js file from config folder and that's it.
If I put the "views" folder on the root (and line 2 is excluded), everything works fine, however, if I use line 2 and the folder structure shown in the picture, I always get an error ENOENT: "no such file or directory.. "
It doesn't matter what format I try to use on line 2 when trying to inform the correct path for the "views" folder, the error message always says the file can't be found and the URL shown ALWAYS misses the "app" folder (it shows every path I try, but it makes the app portion vanish). It doesn't matter what I do, but Node seems to simply ignore that app folder.. it's just as if I can't access it.
Ex:
1) path.join(__dirname, "../app/views"); > ENOENT "C:\root\views\layouts\main.handlebars".
2) path.join(__dirname, "../xapp/views"); > Failed lookup view "C:\root\xapp\views"
Note how the "app" portion of the first option disapears from the url !!
I'm assuming this is a "path" issue and I can't understand what's going on. Could somebody help me out on that, please?
In case someone knows where I could read about the logic behind this "path thing" I'd be greatful. For example: When i use only "__dirname" on line 2, the error message I get is that node "failed to lookup view "filename" in views directory: "path_string/config"... it's kind of hard for me to explain it better (I'm a newbie), but I figure u guys, much more experienced than I am, might understand what I'm talking about.
Thanks in advance for your help.
Vittorio