app.use(express.static(__dirname + '/public')) is mounting a static file handler that is turning the '/' into '/index.html' and sending a 404 because it can't find index.html
If you change the ordering around:
function route(req, res, next) {
if(req.url!='/'){
return next();
}
res.sendfile(__dirname + '/public/desktop.html');
}
app.get('/', route);
app.use(express.static(__dirname + '/public'));
It might work?