Node.js · Middle · Question 59 of 75
What should a Node.js server do when it receives SIGTERM?
- 1Ignore it and keep running
- ✓Correct answer: Stop accepting new connections, finish in-flight requests, close DB connections, then exit
- 3Exit immediately with
process.exit(0)
Explanation
Orchestrators like Kubernetes send SIGTERM before killing a pod. server.close() stops new connections; add a timeout in case something hangs.