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.

40 lines
757 B

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