Node.js · Senior · Question 67 of 75

Why does a Node.js process need a strategy for SIGINT/SIGTERM when it runs as PID 1 in a container?

Explanation

Start Node.js directly (CMD ["node", "server.js"]), not through npm start, which may not forward signals, and handle SIGTERM for graceful shutdown.

Further reading

Problem with a question

Node.js · Senior · question 67

Test yourself

Take the Node.js · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz