Re:Hard-won lessons: Five years with Node.js
by turdnagel on Wednesday April 19, 2017 @08:53PM
(#14153120)
But you're still error handling with `.catch()`. Without that, you'd have an uncaught Promise rejection, which could take down your Node process.
[ Parent
| on HN ]
Re:Hard-won lessons: Five years with Node.js
by always_good on Wednesday April 19, 2017 @08:56PM
(#14153135)
It's common for people to complain about something like a syntax error taking down their whole process, so that's how I read it -- that you're trying to do "too much" catching.
Re:Hard-won lessons: Five years with Node.js
by Waterluvian on Wednesday April 19, 2017 @09:06PM
(#14153186)
I'm not an expert with deploying application servers but shouldn't part of handling lifecycle include the ability for a service to crash and be respawned?
Ie. Be okay if a syntax error crashes your server.
Re:Hard-won lessons: Five years with Node.js
by phamilton on Wednesday April 19, 2017 @11:11PM
(#14153620)
In a "one request per process" model, sure. But if you are handling 1000s of concurrent connections, a syntax error crashing your server means all of those connections error.
Re:Hard-won lessons: Five years with Node.js
by garysieling on Wednesday April 19, 2017 @09:30PM
(#14153267)
If you're comparing to J2EE, ASP.NET, Apache, etc, application servers tend to be big monoliths with lots of features, but Node is much lighter / more modular, so you end up setting that up yourself (that also surprised me)
Re:Hard-won lessons: Five years with Node.js
by smokeyj on Wednesday April 19, 2017 @09:10PM
(#14153199)
Yes you should be using a process manager like PM2.
Re:Hard-won lessons: Five years with Node.js
by garysieling on Wednesday April 19, 2017 @09:28PM
(#14153260)
Yeah, I'm happy to admit that I figured out how Node/Express work entirely by doing things wrong, and then fixing my mistakes :)
I came to this after building C#, Scala, and Java webapps, so it surprised me that this these class of coding errors could take down a site (both screwing up the try/catch or not handling promises).
There is probably some room for Node/the language/Express to make the experience better, either way it's something you'd need to know if you're new to the platform :)