Reputation:
I am currently learning Express ( + Node.js) and I am stuck with a strange error :
Error: Failed to lookup view "index" in views directory "../NODE_tests/Tutorial/app/views"
I have an index.jade in ../NODE_tests/Tutorial/app/views
doctype 5
html
body
h1 Hellow World!
and my app.js is ( should be ) correct :
// require the stuff we need
var express = require("express");
var logger = require("morgan");
var http = require('http');
// build the app
var app = express();
// Set the view directory to /views
app.set('views', __dirname + '/views');
// Let's use the Jade templating language
app.set('view engine', 'jade');
// Logging middleware
app.use(logger('combined'));
app.all('*', function (request, response, next) {
response.writeHead(200, { 'Content-Type': 'text/plain'});
next();
});
// Express routing system ...
app.get('/', function (request, response) {
response.render('index');
});
app.get('*', function (request, response) {
response.end('404 error! Page not found \n');
});
// start it up !
http.createServer(app).listen(8080, '127.0.0.1');
running node app.js is raising this error ... where am I wrong ?
Upvotes: 1
Views: 343
Reputation:
for uncleared reason the index.jade file was named index.jade.log , but .log was invisible... ( copy paste from another file...) sorry for this unnecessary question...
discover it using OSX info on the file
Upvotes: 1