Skip to content

Commit

Permalink
Default to index.html, but read the path out of the URL
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuswestin committed Apr 22, 2011
1 parent 05645e4 commit b8d61f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example/server.js
Expand Up @@ -8,8 +8,8 @@ requireServer.addPath('.')

console.log('starting simple file server on localhost:8080')
http.createServer(function(req, res) {
fs.readFile('index.html', function(err, content) {
if (err) { throw err }
fs.readFile(req.url.substr(1) || 'index.html', function(err, content) {
if (err) { return res.end(err.stack) }
res.end(content)
})
}).listen(8080)
Expand Down

0 comments on commit b8d61f6

Please sign in to comment.