refactor(route) route

This commit is contained in:
coderaiser 2015-04-07 02:48:54 -04:00
parent 0026971da2
commit 4334b34637

View file

@ -163,20 +163,7 @@
if (dir)
dir.path = format.addSlashToEnd(name);
if (error)
if (error.code !== 'ENOTDIR')
ponse.sendError(error, p);
else
fs.realpath(path, function(error, pathReal) {
if (!error)
p.name = pathReal;
else
p.name = path;
p.gzip = false;
ponse.sendFile(p);
});
else
if (!error)
buildIndex(dir, function(error, data) {
p.name = PATH_INDEX;
@ -185,6 +172,18 @@
else
ponse.send(data, p);
});
else if (error.code !== 'ENOTDIR')
ponse.sendError(error, p);
else
fs.realpath(path, function(error, pathReal) {
if (!error)
p.name = pathReal;
else
p.name = path;
p.gzip = false;
ponse.sendFile(p);
});
});
}
}