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
Custom server options for adapter-node #8794
Comments
Have you seen https://kit.svelte.dev/docs/adapter-node#custom-server and is this insufficient? What else are you looking for? If all you want to do is to start another server alongside the default one, you could also just put code to start the server in |
Yes, I have seen it, but to my understanding it is instructing me to edit the files in my build folder, which I cannot do. If I missed something please say so. 😄
How would I go about doing this? Would I start the server on the first request, and do nothing for future requests? Or do I just copy my server code in there, and sveltekit will just run it for me when my app starts? |
The example code is importing from
Literally just this: // src/hooks.server.js
import { start_server } from '$lib/my-stuff.js';
start_server(); That code will run as soon as your SvelteKit server starts. |
Cool, thank you. I think this is a solution to my problem |
The https://kit.svelte.dev/docs/adapter-node#custom-server is not so clear how to customize node server with express. Could you please share the code how to do customize node server, such as how to compile/build my-server.js, rather than index.js |
@Rich-Harris being facing challenges on deploying my sveltekit app in my cPanel share hosting with phusionPassenger. Apparently it uses commonjs and if i force it to use es syntax, it shows 500 response error. |
Describe the problem
Currently, when using the node apater you are stuck with one type of server that is automatically created for you when building. This however is not a great solution for many people.
There are hosts that build your application on the server, and you don't have the ability to edit the files in the build directory.
I currently want to implement a socket.io server to start alongside sveltekit, but I haven not found any way to do this currently.
Describe the proposed solution
The best was to do this in my opinion would be to use a process like mankins did in his own adapter.
Alternatives considered
I have tried using the adapter mentioned above, but it only allows 1 file to be transferred, so I couldn't copy the handler.js of the default node apater to make sveltekit actually work.
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: