Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Hello. #32

Closed
wants to merge 3 commits into from

2 participants

@sonnyp

Just few minor improvements.

@phstc phstc commented on the diff
lib/node-static.js
@@ -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) {
@phstc Collaborator
phstc added a note

Hey!

Can the indexFile be an option?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@phstc phstc commented on the diff
lib/node-static.js
@@ -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'),
@phstc Collaborator
phstc added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@phstc
Collaborator

Hey @sonnyp!

I made few comments, could you check them?

@phstc phstc closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 29, 2011
  1. @sonnyp

    add xhtml mime type

    sonnyp authored
  2. @sonnyp
  3. @sonnyp

    allow to specify the index file

    sonnyp authored
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +1 −1  README.md
  2. +3 −2 lib/node-static.js
  3. +1 −0  lib/node-static/mime.js
View
2  README.md
@@ -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);
}
});
});
View
5 lib/node-static.js
@@ -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) {
@phstc Collaborator
phstc added a note

Hey!

Can the indexFile be an option?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ this.indexFile = indexFile;
if (root && (typeof(root) === 'object')) { options = root, root = null }
this.root = path.resolve(root || '.');
@@ -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'),
@phstc Collaborator
phstc added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
that = this;
fs.stat(htmlIndex, function (e, stat) {
View
1  lib/node-static/mime.js
@@ -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",
Something went wrong with that request. Please try again.