-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
In your documentation you explain running
node ./server.js
Then running:
python -m SimpleHTTPServer
or
http-server
In fact you are already have a node http server running you can use to server the files. Simple change server.js to server static files via the handler:
function handler (req, res) {
if (req.url === '/') {
req.url = '/index.html';
}
console.log('handler', req.url);
fs.readFile(__dirname + '/src' + req.url, function (err,data) {
if (err) {
res.writeHead(404);
res.end(JSON.stringify(err));
return;
}
res.writeHead(200);
res.end(data);
});
}
Now both Socket.io and the http server will be running on the same address and port
Metadata
Metadata
Assignees
Labels
No labels