{"id":18436,"library":"http-server-plus","title":"http-server-plus","description":"An augmented Node.js HTTP server that supports HTTP, HTTPS, and HTTP/2 on the same instance, with the ability to listen on multiple ports, sockets, or file descriptors simultaneously. Version 1.0.0 is stable with irregular release cadence. Key differentiators include unified server creation via `create()`, promise-based `.listen()` with nice addresses, and built-in support for HTTP/2 via `http2` (Node >=8) or `spdy` (Node <8). Suitable for advanced server setups needing multiple protocols or endpoints.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/JsCommunity/http-server-plus","tags":["javascript","http","https","server","ports"],"install":[{"cmd":"npm install http-server-plus","lang":"bash","label":"npm"},{"cmd":"yarn add http-server-plus","lang":"bash","label":"yarn"},{"cmd":"pnpm add http-server-plus","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The module has both a default export and named exports since v1.0.0. For CommonJS, require returns an object with `create` and `Server` properties, not a function.","wrong":"const httpServerPlus = require('http-server-plus')","symbol":"default export","correct":"import httpServerPlus from 'http-server-plus'"},{"note":"Using named import is recommended for tree-shaking. The `create` function is the main API.","wrong":"const create = require('http-server-plus').create","symbol":"create","correct":"import { create } from 'http-server-plus'"},{"note":"Server class can be directly used to create instances, though `create()` is preferred.","wrong":"const Server = require('http-server-plus').Server","symbol":"Server","correct":"import { Server } from 'http-server-plus'"}],"quickstart":{"code":"import { create } from 'http-server-plus';\nimport express from 'express';\n\nconst app = express();\napp.get('/', (req, res) => res.send('Hello World'));\n\nconst server = create(app);\n\n(async () => {\n  try {\n    const addresses = await Promise.all([\n      server.listen({ hostname: 'localhost', port: 3000 }),\n      server.listen({ hostname: 'localhost', port: 3001 })\n    ]);\n    console.log('Server listening on:', addresses);\n  } catch (err) {\n    console.error('Failed to start:', err);\n  }\n})();","lang":"javascript","description":"Shows creating a server with Express request handler, listening on two ports concurrently using async/await."},"warnings":[{"fix":"Use async/await or .then() to handle the Promise returned by listen().","message":"listen() now returns a Promise instead of the server object","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"For Node >=8, use http2.createSecureServer as shown in docs.","message":"Support for spdy (HTTP/2 for Node <8) is deprecated, use built-in http2 module","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use Promise.all() to await all listen() calls as shown in the example.","message":"When calling listen() with multiple options, the Promise returned from each listen() must be awaited","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use `const { create } = require('http-server-plus');`","cause":"Incorrect import of default export when expecting named export in CommonJS.","error":"TypeError: Cannot read property 'create' of undefined"},{"fix":"Check error.niceAddress for details; ensure ports are free, certificates exist, and sockets paths are valid.","cause":"Hostname or port already in use, missing certificates, or invalid socket path.","error":"Error: The server could not listen on ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}