You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @ashokgelal, I found that the second parameter of the listen function is a callback that returns a Server object, which can be used to stop the server.
importElysiafrom"elysia";import{node}from"@elysiajs/node";constapp=newElysia({adapter: node()}).listen(3000,(server)=>{setTimeout(()=>{console.log("Stopping server after 5 seconds");server.stop();},5000);});
Upon reviewing the code, I noticed that this file isn't enforcing the implementation of the stop method on the Elysia instance. As a result, the node adapter doesn't implement it.
I'm not sure why it's not included in the type definition.
What version of Elysia is running?
1.2.0
What platform is your computer?
Darwin 24.1.0 arm64 arm
What steps can reproduce the bug?
I'm using node adapter and when calling
stop
it throwsthis.server.stop is not a function
error.Code snippet:
What is the expected behavior?
It should stop the server listening to request.
What do you see instead?
UnhandledPromiseRejectionWarning: TypeError: this.server.stop is not a function
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes
The text was updated successfully, but these errors were encountered: