Reputation: 45
I'm working in Cloud9 and when trying to run the application i'm greeted with the error failed to lookup view "/landing.ejs" in views directory: Thus far I have:
var express = require("express");
var app = express();
app.get("/", function(req, res){
res.render("/landing.ejs");
})
app.listen(process.env.PORT, process.env.IP, function(){
console.log("Server is running");
})
My file tree is structed as such App > v1 > app.js package.json views > landing.ejs
Upvotes: 0
Views: 2926
Reputation: 849
At first,you have to set default view files path app.set('views', __dirname + '/view_files_folder_path');
after the line var app = express();
.
Then modify this res.render("/landing.ejs");
to res.render("landing.ejs");
Hope this will work :)
Upvotes: 3