UNPKG

1.02 kBJavaScriptView Raw
1
2/*!
3 * Connect - HTTPServer
4 * Copyright(c) 2010 Sencha Inc.
5 * Copyright(c) 2011 TJ Holowaychuk
6 * MIT Licensed
7 */
8
9/**
10 * Module dependencies.
11 */
12
13var HTTPServer = require('./http').Server
14 , https = require('https');
15
16/**
17 * Initialize a new `Server` with the given
18 *`options` and `middleware`. The HTTPS api
19 * is identical to the [HTTP](http.html) server,
20 * however TLS `options` must be provided before
21 * passing in the optional middleware.
22 *
23 * @params {Object} options
24 * @params {Array} middleawre
25 * @return {Server}
26 * @api public
27 */
28
29var Server = exports.Server = function HTTPSServer(options, middleware) {
30 this.stack = [];
31 middleware.forEach(function(fn){
32 this.use(fn);
33 }, this);
34 https.Server.call(this, options, this.handle);
35};
36
37/**
38 * Inherit from `http.Server.prototype`.
39 */
40
41Server.prototype.__proto__ = https.Server.prototype;
42
43// mixin HTTPServer methods
44
45Object.keys(HTTPServer.prototype).forEach(function(method){
46 Server.prototype[method] = HTTPServer.prototype[method];
47});
\No newline at end of file