JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1038
  • Score
    100M100P100Q98751F
  • License ISC

Augmented `http.Server`, HTTP/HTTPS and multiple ports on the same instance

Package Exports

  • http-server-plus

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-server-plus) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

http-server-plus

Build Status Dependency Status devDependency Status

Augmented http.Server, HTTP/HTTPS and multiple ports on the same instance

Install

Download manually or with package-manager.

npm

npm install --save http-server-plus

Example

// The `create()` method can also take a `requestListener`, just like
// `http.createServer()`.
var app = require('express')();
var server = require('http-server-plus').create(app);

// The listen method returns a promise which resolves when the server
// starts listening.
require('bluebird').all([
  // Listen on port localhost:80.
  server.listen({
    host: 'localhost',
    port: 80,
  }),

  // Listen on port 443, using HTTPS.
  server.listen({
    port: 443,

    cert: require('fs').readFileSync(__dirname +'/certificate.pem'),
    key: require('fs').readFileSync(__dirname +'/private_key.pem'),
  }),

  // Listen on socket.
  server.listen({
    socket: __dirname +'/http.sock',
  }),
]).then(function () {
  console.log('server is listening on', server.addresses());
}).catch(function (error) {
  console.error('The server could not listen', error)  ;
});

Contributing

Contributions are very welcome, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Julien Fontanet