You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

31 lines
636 B

'use strict';
var http = require('http');
var https = require('https');
exports.port = 6767;
exports.portSSL = 16167;
exports.createServer = function (port) {
port = port || exports.port;
var s = http.createServer(function (req, resp) {
s.emit(req.url, req, resp);
});
s.port = port;
s.url = 'http://localhost:' + port;
s.protocol = 'http';
return s;
};
exports.createSSLServer = function (port, opts) {
port = port || exports.portSSL;
var s = https.createServer(opts, function (req, resp) {
s.emit(req.url, req, resp);
});
s.port = port;
s.url = 'https://localhost:' + port;
s.protocol = 'https';
return s;
};