mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
feat(nodeserver): if index.html exists, serve it instead of directory listing
This commit is contained in:
parent
afc81b554e
commit
02332107e5
1 changed files with 9 additions and 1 deletions
|
|
@ -107,7 +107,15 @@ StaticServlet.prototype.handleRequest = function(req, res) {
|
|||
if (err)
|
||||
return self.sendMissing_(req, res, path);
|
||||
if (stat.isDirectory())
|
||||
return self.sendDirectory_(req, res, path);
|
||||
return fs.stat(path + 'index.html', function(err, stat) {
|
||||
// send index.html if exists
|
||||
if (!err)
|
||||
return self.sendFile_(req, res, path + 'index.html');
|
||||
|
||||
// list files otherwise
|
||||
return self.sendDirectory_(req, res, path);
|
||||
});
|
||||
|
||||
return self.sendFile_(req, res, path);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue