Choose values, then copy one format.

Module output

CommonJS and ESM include the full representable Config surface.

CLI output

Includes only flags the command supports and warns when advanced choices are omitted.

JSON output

A serializable Config object for module code or storage—not a CLI config file.

Run the generated snippet locally. This page assembles CJS, ESM, CLI, and JSON configuration. A local Node process exercises listener, filesystem, and TLS behavior. Review CLI quoting when paths contain shell control characters.

Full Config surface

Configuration

Location and host routing

Keys: root, host, port, domain, domains, and server.index. Defaults and Host-routing rules →

HTTP behavior

Keys: server.noCache, server.allowDotfiles, server.compression, server.compressionThreshold, server.spaFallback, server.maxRequestBodyBytes, and top-level verbose. Behavior details →

Compression thresholdMinimum uncompressed bytes
Timeouts milliseconds

Keys: server.timeout, requestTimeout, headersTimeout, and keepAliveTimeout. Disable semantics and units →

false or 0 disables a timeout. The generated snippets use false when Off is checked.

File types and restrictions

Keys: contentType and restrictedType. MIME fallback, 403, and 415 rules →

Use extension keys without a dot. contentType:false removes automatic MIME selection; served files use application/octet-stream. One MIME entry set to false rejects that extension with 415.

Logging and errors

Keys: log, logBody, logFunction, and errors. Logging → Error responses →

These fields accept plain JSON objects. Invalid objects are ignored and marked below.

JSON fields are valid.

HTTPS

Keys: https.privateKey, certificate, ca, passphrase, port, and only. HTTPS requirements →

const {Server}=require('node-http-server');

const server=new Server({
    host:'127.0.0.1',
    port:8080,
    root:'./public'
});

server.deploy();
CommonJS module Ready to copy
npm install node-http-server