diff --git a/static.js b/static.js index 83c3b20a..69108eb3 100755 --- a/static.js +++ b/static.js @@ -1,18 +1,22 @@ #!/usr/bin/env node -var http = require("http"), - url = require("url"), - path = require("path"), - fs = require("fs"), - mime = require("mime"), - port = process.env.PORT || 8888; +var http = require("http") + , path = require("path") + , mime = require("mime") + , url = require("url") + , fs = require("fs") + , port = process.env.PORT || 8888; + +// compatibility with node 0.6 +if (!fs.exists) + fs.exists = path.exists; http.createServer(function(request, response) { var uri = url.parse(request.url).pathname , filename = path.join(process.cwd(), uri); - path.exists(filename, function(exists) { + fs.exists(filename, function(exists) { if(!exists) { response.writeHead(404, {"Content-Type": "text/plain"}); response.write("404 Not Found\n");