Reputation:
I'm stuck on it since Friday, please.. somebody help me!!!
I have this route in my app.js:
app.get('/', function(req, res) {
res.render('login', {
user: req.user
});
});
He is rendering the layout inside the views folder, which is inside the server folder.
I have this configuration in my app.js:
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
It's not working put:
app.set('views', __dirname + '../public');
Because it's searching like this:
"app/server../public"
and i need this:
"app/public"
Please, if someone know fix this, please help me!
Upvotes: 0
Views: 160
Reputation: 698
Always use the path
module to join paths.
var path = require('path');
var uri = path.join(__dirname, '../public');
Upvotes: 1