ProtectedconstructorConstructs a NodeHTTPAdapter instance.
This constructor is protected and is intended to be used via the static create method.
The application blueprint for dependency resolution.
Protected ReadonlyblueprintProtected ReadonlyhooksProtected ReadonlyloggerProtected ReadonlymiddlewareProtected ReadonlyresolvedProtected ReadonlyserverProtected ReadonlyurlProtectedbuildBuild the raw response.
The event context.
OptionaleventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>
The event handler to be run.
The raw response wrapper.
ProtectedcreateProtected
Creates the HTTP or HTTPS server based on the adapter's configuration.
A NodeHttpServer instance.
ProtectedeventProtected
Handles incoming HTTP requests and sends them through the adapter's event pipeline.
The raw HTTP request object.
The raw HTTP response object.
A promise resolving to a ServerResponse (e.g., ServerResponse).
ProtectedexecuteExecute the event handler lifecycle hooks.
The hook to execute.
The event handler to be run.
ProtectedexecuteExecute adapter lifecycle hooks.
The hook's name.
Optionalcontext: NodeHttpAdapterContext
The event context.
Optionalerror: any
The error to handle.
ProtectedhandleHandle error.
The error to handle.
The event context.
The raw response.
ProtectedhandleHandle the event.
The event context.
The event handler to be run.
The raw response wrapper.
ProtectedhardenProtected
Applies denial-of-service hardening to the HTTP(S) server.
Sets strict defaults for header count and connection timeouts (Slowloris, socket
exhaustion, header floods). Every knob is overridable via stone.adapter.server
(e.g. { headersTimeout: 30000, maxHeadersCount: 60 }); maxRequestsPerSocket is
only applied when explicitly configured.
The freshly created server.
The hardened server.
ProtectedmakeCreate pipeline options for the Adapter.
The pipeline options for transforming the event.
ProtectedonProtectedresolveGet the error handler for the given error.
The error to get the handler for.
The error handler.
ProtectedresolveStarts the HTTP/HTTPS server and listens for incoming requests.
A promise that resolves to an ExecutionResultType (usually NodeHttpServer) when the server starts successfully.
ProtectedsendSend the raw event through the destination.
The event context.
The event handler to be run.
Platform-specific response.
ProtectedsetupProtected
Sets up global error handlers for uncaught exceptions and unhandled rejections. Ensures critical errors are logged and the process exits safely.
ProtectedsetupSets up a shutdown listener to gracefully stop the server on SIGINT/SIGTERM.
Graceful means "let the requests in flight finish", not "wait for every socket ever opened".
close() alone means the latter: a keep-alive connection sitting idle has no request to finish,
yet it holds the callback, so process.exit(0) never runs. A signalled process then never dies.
Whatever sent the signal waits for its own timeout and hard-kills, which is how a rolling deploy
turns a graceful shutdown into a killed one and an onStop hook becomes a lie.
So idle connections are closed immediately, requests in flight get the grace period, and the process exits either way.
ProtectedvalidateValidate the context and event handler.
The context to validate.
The event handler to validate.
StaticcreateCreates a new NodeHTTPAdapter instance.
The application blueprint.
A new instance of NodeHTTPAdapter.
Node.js HTTP Adapter for the Stone.js framework.
The
NodeHTTPAdapteris responsible for integrating a Node.js HTTP/HTTPS server with the Stone.js framework, converting incoming HTTP requests intoIncomingHttpEventinstances, and processing outgoing responses into theOutgoingHttpResponseformat.It provides lifecycle hooks for initialization, termination, and error handling, ensuring seamless integration with Stone.js.
Template: RawEvent
The raw HTTP event type (e.g.,
IncomingMessage).Template: RawResponse
The raw HTTP response type (e.g.,
ServerResponse).Template: Server
The server instance type (e.g.,
NodeHttpServer).Template: IncomingEvent
The Stone.js incoming event type (e.g.,
IncomingHttpEvent).Template: IncomingEventOptions
Options for creating an incoming event.
Template: OutgoingResponse
The outgoing response type (e.g.,
OutgoingHttpResponse).Template: Context
The adapter context type (e.g.,
NodeHttpAdapterContext).