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

Support for https #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
var static = require('node-static');
var http = require('http');
var https = require('https');
var fs = require('fs');
// Create a node-static server instance
var file = new(static.Server)();

// We use the http modules createServer function and
// We use the https module's createServer function and
// rely on our instance of node-static to serve the files
var app = http.createServer(function (req, res) {
var options = {
key: fs.readFileSync('tls/server.key', 'utf8'),
cert: fs.readFileSync('tls/server.crt', 'utf8')
};
var app = https.createServer(options, function (req, res) {
file.serve(req, res);
}).listen(8181);

Expand Down Expand Up @@ -50,4 +55,4 @@ io.sockets.on('connection', function (socket){
}
socket.emit('log', array);
}
});
});