Closed mustafaekim closed 1 year ago
shouldn't it be await start()
at the bottom?
shouldn't it be
await start()
at the bottom?
Nope, you cannot use await inside the file but only inside an async function.
By the way, the exact same code works in one of my machine (the script never ends, the server runs and respond to requests as expected), on another machine the script immediately terminates as I've written in my previous message and the server does not run anymore. Both of the computers use the same node version and the same npm version of local-web-server. How could this be?
Nope, you cannot use await inside the file but only inside an async function.
You can.. top-level await has been available in Node since at least v14.. You must await
your start
method.
Closing for now, if you confirm it's definitely a bug in local-web-server let me know..
Hello,
I start the server but it does not stay open, rather the script ends right after the server starts up. Please see the code below:
When I run this peace of code through the "node start-server.js" command, I am seeing the log "Webserver running..." log on the console but right after that the script ends and the server does not live any more.
Does anyone have a guesss why the script is terminated rather than waiting to respond incoming requests?