Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello. #32

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -74,7 +74,7 @@ For example, you could serve an error page, when the initial request wasn't foun
request.addListener('end', function () {
fileServer.serve(request, response, function (e, res) {
if (e && (e.status === 404)) { // If the file wasn't found
fileServer.serveFile('/not-found.html', request, response);
fileServer.serveFile('/not-found.html', 404, {}, request, response);
}
});
});
Expand Down
5 changes: 3 additions & 2 deletions lib/node-static.js
Expand Up @@ -17,7 +17,8 @@ var serverInfo = 'node-static/' + this.version.join('.');
this.store = {};
this.indexStore = {};

this.Server = function (root, options) {
this.Server = function (root, options, indexFile) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey!

Can the indexFile be an option?

options["indexFile"] = "index.html"

this.indexFile = indexFile;
if (root && (typeof(root) === 'object')) { options = root, root = null }

this.root = path.resolve(root || '.');
Expand Down Expand Up @@ -47,7 +48,7 @@ this.Server = function (root, options) {
};

this.Server.prototype.serveDir = function (pathname, req, res, finish) {
var htmlIndex = path.join(pathname, 'index.html'),
var htmlIndex = path.join(pathname, this.indexFile || 'index.html'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.options["indexFile"] || "index.html" ???

that = this;

fs.stat(htmlIndex, function (e, stat) {
Expand Down
1 change: 1 addition & 0 deletions lib/node-static/mime.js
Expand Up @@ -130,6 +130,7 @@ this.contentTypes = {
"wrl": "model/vrml",
"wvx": "video/x-ms-wvx",
"xbm": "image/x-xbitmap",
"xhtml": "application/xhtml+xml",
"xlw": "application/vnd.ms-excel",
"xml": "text/xml",
"xpm": "image/x-xpixmap",
Expand Down