Answer the question
In order to leave comments, you need to log in
Node.js Express 3.0: handling missing static file
Good day.
Express config is like this
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({key:'session',secret:'123456789',cookie:{maxAge:86400000}}));
app.use(app.router);
app.use(express.static(__dirname+'/view'));
app.use(express.errorHandler);
Answer the question
In order to leave comments, you need to log in
After app.use express.static , insert a middleware that will return a 404 error. For example, like this:
app.use(function(req, res){
res.send(404, 'Sorry, we cannot find that!');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question