Registry / http-networking / http-server-plus

http-server-plus

JSON →
library1.0.0jsnpmunverified

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.

npm install http-server-plus
INSTALL
IMPORT
SIG · HTTP-SERVER-PLUS
H
http-server-plus
http-networkingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export
import httpServerPlus from 'http-server-plus'
const httpServerPlus = require('http-server-plus')
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.
create
import { create } from 'http-server-plus'
const create = require('http-server-plus').create
Using named import is recommended for tree-shaking. The `create` function is the main API.
Server
import { Server } from 'http-server-plus'
const Server = require('http-server-plus').Server
Server class can be directly used to create instances, though `create()` is preferred.

Shows creating a server with Express request handler, listening on two ports concurrently using async/await.

import { create } from 'http-server-plus'; import express from 'express'; const app = express(); app.get('/', (req, res) => res.send('Hello World')); const server = create(app); (async () => { try { const addresses = await Promise.all([ server.listen({ hostname: 'localhost', port: 3000 }), server.listen({ hostname: 'localhost', port: 3001 }) ]); console.log('Server listening on:', addresses); } catch (err) { console.error('Failed to start:', err); } })();
Debug
Known issues
breakinglisten() now returns a Promise instead of the server object
fix
Use async/await or .then() to handle the Promise returned by listen().
affects: >=1.0.0
deprecatedSupport for spdy (HTTP/2 for Node <8) is deprecated, use built-in http2 module
fix
For Node >=8, use http2.createSecureServer as shown in docs.
affects: >=1.0.0
gotchaWhen calling listen() with multiple options, the Promise returned from each listen() must be awaited
fix
Use Promise.all() to await all listen() calls as shown in the example.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read property 'create' of undefined
Incorrect import of default export when expecting named export in CommonJS.
fix
Use `const { create } = require('http-server-plus');`
Error: The server could not listen on ...
Hostname or port already in use, missing certificates, or invalid socket path.
fix
Check error.niceAddress for details; ensure ports are free, certificates exist, and sockets paths are valid.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
http-server-plus — npm install http-server-plus · libregistry