-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] allow node adapter to configure listen path #2048
[feat] allow node adapter to configure listen path #2048
Conversation
🦋 Changeset detectedLatest commit: a1cbc29 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
80c162c
to
08bcf29
Compare
@matths can you update the PR so that the Lint job passes? |
If you got #2051 merged would you no longer need this PR then? Because I think the more we can expose the underlying to allow users to configure it directly that's better vs trying to add all the options here individually |
yes, I agree, we can skip and close this PR as I'll focus on #2051. |
c4bd0aa
to
028b7a1
Compare
The build and run process using the current @sveltejs/adapter-node only allows to run the final node project listening to either host/port or 0.0.0.0/port specified by an environment variable.
I would expect it to allow listening to a path instead as specified by node, check documentation https://nodejs.org/api/net.html#net_server_listen_path_backlog_callback
Use case:
When using a reverse proxy that expects the node application to listen for a path (domain socket file) instead of a host and port, this was currently not available in the node-adapter.
With this pull request I want to make an offer for this missing feature.
With this feature branch applied yo can now do
SERVER_PATH=/tmp/socket node build
to have your server listen to a domain socket file instead of a port.I think this is somewhat related to the #1610 as this would be the other attempt to solve this problem. If the node-apapter would lead to a middleware instead of a whole node server, the developer would be free to have his own node server and have it listen to a domain socket file instead of host/port.
Tests
I did clone the existing smoke test for this use case.
And I used the changed adapter-node within my project:
packages/adapter-node
runpnpn build
cp packages/adapter-node/index.js packages/adapter-node/index.d.ts packages/adapter-node/files/* ~/myproject/src/lib/
import adapter from './src/lib/adapter-node/index.js';
instead ofimport adapter from '@sveltejs/adapter-node';
in your projects svelte.config.jsSERVER_PATH=/tmp/socket node build
Changeset
I tried to include a changeset, but I am not sure which files to add.