{"_id":"@carsondarling/multilisten","_rev":"4-2791aaf73711ad5ad69a0ad2964b8283","name":"@carsondarling/multilisten","description":"Listen on both HTTP and HTTPS","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@carsondarling/multilisten","version":"1.0.0","description":"Listen on both HTTP and HTTPS","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/carsondarling/multilisten.git"},"author":{"name":"Carson Darling","email":"cdarling@restdevices.com"},"bugs":{"url":"https://github.com/carsondarling/multilisten/issues"},"homepage":"https://github.com/carsondarling/multilisten#readme","devDependencies":{"chai":"^3.2.0","chai-as-promised":"^5.1.0","mocha":"^2.2.5","supertest":"^1.0.1","supertest-as-promised":"^2.0.2"},"license":"MIT","dependencies":{"debug":"^2.2.0","lodash":"^3.10.0"},"gitHead":"e17a3d98aa3fca61e8e0435cc28be73fb198df6a","_id":"@carsondarling/multilisten@1.0.0","_shasum":"ea061a94dd4da5396721e685ca1958880cbcc6b9","_from":".","_npmVersion":"2.11.1","_nodeVersion":"0.10.38","_npmUser":{"name":"carsondarling","email":"carsondarling@gmail.com"},"dist":{"shasum":"ea061a94dd4da5396721e685ca1958880cbcc6b9","tarball":"https://registry.npmjs.org/@carsondarling/multilisten/-/multilisten-1.0.0.tgz","integrity":"sha512-8RiBFCy5asgA150va+h7b88M72l/aQZHMY42s86uLtBqRZ43L4XnsP8i2n2FhzuyiCoxpwx/eW1ub741LoZLmw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBsJbxoqJOzkPxzvGQYOIxWq18+8lxcnl6x/2KYvhIlJAiBZh7U2Xt3MlslKy9BMu8BqbLhXafyZ7g9KL809NJ1ThA=="}]},"maintainers":[{"name":"carsondarling","email":"carsondarling@gmail.com"}]},"1.1.0":{"name":"@carsondarling/multilisten","version":"1.1.0","description":"Listen on both HTTP and HTTPS","main":"index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/carsondarling/multilisten.git"},"author":{"name":"Carson Darling","email":"cdarling@restdevices.com"},"bugs":{"url":"https://github.com/carsondarling/multilisten/issues"},"homepage":"https://github.com/carsondarling/multilisten#readme","devDependencies":{"chai":"^3.2.0","chai-as-promised":"^5.1.0","mocha":"^2.2.5","supertest":"^1.0.1","supertest-as-promised":"^2.0.2"},"license":"MIT","dependencies":{"debug":"^2.2.0","lodash":"^3.10.0"},"gitHead":"264ae9faee8d525702c51ca2a7799eeeee390efe","_id":"@carsondarling/multilisten@1.1.0","_shasum":"918e2de6a368387902ce9f82cb02c0b65bf1faad","_from":".","_npmVersion":"2.11.1","_nodeVersion":"0.10.38","_npmUser":{"name":"carsondarling","email":"carsondarling@gmail.com"},"dist":{"shasum":"918e2de6a368387902ce9f82cb02c0b65bf1faad","tarball":"https://registry.npmjs.org/@carsondarling/multilisten/-/multilisten-1.1.0.tgz","integrity":"sha512-/NE3coC+oS2zWkWD5n+AZORvMexBtm69lXc+pwtdp9/UXPULHe7vBr5yTElwxUAUFuY6plGH3s/GPEvBAh0m9Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCKnWO2zM/OluRo11AqAeIyEBoUbjMGIJV5PxPbeL/BJAIgSSagwMgrazMv0o8CNWX5/g3UNrJoLzEJmBKlhoduBNI="}]},"maintainers":[{"name":"carsondarling","email":"carsondarling@gmail.com"}]}},"readme":"# Multilisten\n\nMultilisten makes it super easy to listen on both HTTP and HTTPS, using the same\napp instance.\n\n## Example Usage\n\n```javascript\nvar app = function(req, res) {\n  res.end('Hello World');\n};\n\nmultilisten(app, {\n  mode: 'redirect',\n  sslOptions: {\n    cert: '<certificate>',\n    key: '<key>'\n  }\n});\n\n/**\n * App is now listening on both ports 80 and 443, and will automatically\n * redirect from HTTP to HTTPS.\n */\n```\n\n## API\n\n### multilisten(app, options)\n\n#### app\n\n`app` is any Javascript function that can serve as a request listener, with the signature:\n\n```javascript\nfunction(request, response) { }\n```\n\nThe app exposed by [Express](expressjs.com) is fully compatible, so Multilisten will work with any Express-based application with minimal modification.\n\n#### options\n\n**options.httpPort** The port for the HTTP server to listen on. Default 80\n\n**options.httpsPort** The port for the HTTPS server to listen on. Default 443\n\n**options.sslOptions** Options for the HTTPS server, passed directly to Node's HTTPS module\n\n**options.httpsBaseURL** The base URL to redirect HTTP requests to\n\nIf this is not specified, only the protocol will be changed (e.g. `http://domain.com/blah` will be redirected to `https://domain.com/blah`, ignoring ports).\n\nIf it is specified (e.g. with `https://domain.com:8443`), a the path will be appended (e.g. `http://domain:8000/blah` will be redirected to `https://domain.com:8443`). Please be careul to include HTTPS in the base URL, otherwise it is possible to redirect to an unsecure endpoint.\n\n**options.mode**\n\nThe mode determines which servers Multilisten will use to listen, and how they will respond. There are 4 possible modes: `http`, `https`, `both`, and `redirect`. Default `redirect`\n\n|    Mode    |   HTTP Response   |  HTTPS Response  |       Description        |\n|------------|-------------------|------------------|--------------------------|\n| `http`     | Handled by `app`  | Disabled         | Listen on HTTP only      |\n| `https`    | Disabled          | Handled by `app` | Listen on HTTPS only     |\n| `both`     | Handled by `app`  | Handled by `app` | Use either HTTP or HTTPS |\n| `redirect` | Redirect to HTTPS | Handled by `app` | Force HTTPS (default)    |\n","maintainers":[{"name":"carsondarling","email":"carsondarling@gmail.com"}],"time":{"modified":"2022-06-12T15:42:15.117Z","created":"2015-07-21T18:38:15.286Z","1.0.0":"2015-07-21T18:38:15.286Z","1.1.0":"2015-07-21T19:26:52.081Z"},"homepage":"https://github.com/carsondarling/multilisten#readme","repository":{"type":"git","url":"git+https://github.com/carsondarling/multilisten.git"},"author":{"name":"Carson Darling","email":"cdarling@restdevices.com"},"bugs":{"url":"https://github.com/carsondarling/multilisten/issues"},"license":"MIT","readmeFilename":"README.md"}