2014-07-15 03:20:49 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
'use strict';
|
|
|
|
|
2016-06-28 00:22:23 +00:00
|
|
|
var https = require('https');
|
|
|
|
var port = process.argv[2] || 8043;
|
|
|
|
var fs = require('fs');
|
|
|
|
var path = require('path');
|
|
|
|
var server;
|
|
|
|
var options = {
|
|
|
|
key: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'privkey.pem'))
|
|
|
|
, cert: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'fullchain.pem'))
|
|
|
|
};
|
2014-07-15 03:20:49 +00:00
|
|
|
|
|
|
|
function app(req, res) {
|
|
|
|
res.setHeader('Content-Type', 'text/plain');
|
|
|
|
res.end('Hello, encrypted world!');
|
|
|
|
}
|
|
|
|
|
|
|
|
server = https.createServer(options, app).listen(port, function () {
|
|
|
|
port = server.address().port;
|
|
|
|
console.log('Listening on https://127.0.0.1:' + port);
|
|
|
|
console.log('Listening on https://' + server.address().address + ':' + port);
|
2016-06-28 00:02:18 +00:00
|
|
|
console.log('Listening on https://localhost.daplie.com:' + port);
|
2014-07-15 03:20:49 +00:00
|
|
|
});
|