Skip to content

Add note for custom Node.js server implementation #15734

@hyunbinseo

Description

@hyunbinseo

Describe the problem

Alternatively, you can import the handler.js file, which exports a handler suitable for use with Express, …

https://svelte.dev/docs/kit/adapter-node#Custom-server

While these environment values are referenced by handler.js:

env('ADDRESS_HEADER', '').toLowerCase();
env('BODY_SIZE_LIMIT', '512K'));
env('HOST_HEADER', '').toLowerCase();
env('ORIGIN', undefined));
env('PORT_HEADER', '').toLowerCase();
env('PROTOCOL_HEADER', '').toLowerCase();
env('XFF_DEPTH', '1'));

these are only referenced by start.js, and must be manually implemented.

env('HEADERS_TIMEOUT');
env('HOST', '0.0.0.0');
env('IDLE_TIMEOUT', '0'));
env('KEEP_ALIVE_TIMEOUT');
env('LISTEN_FDS', '0'));
env('LISTEN_PID', '0'));
env('PORT', !path && '3000');
env('SHUTDOWN_TIMEOUT', '30'));
env('SOCKET_PATH', false);

The example code does give a hint, but it isn't explicit:

// PORT environment variable does not seem to be utilized by `my-server.js`

app.listen(3000, () => {
  console.log('listening on port 3000');
});

Describe the proposed solution

Add a table showing what environment variables and their features must be manually implemented.

A more in-depth example with a modern library would be also nice. (e.g. Hono)

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions