Recall & Review
beginner
What is graceful shutdown in Node.js?
Graceful shutdown means closing the server and cleaning up resources properly before the app stops, so no requests are lost or data corrupted.
Click to reveal answer
beginner
Which Node.js event is commonly used to detect when the process should shut down?
The 'SIGINT' signal is often used to detect when the user presses Ctrl+C to stop the process.
Click to reveal answer
intermediate
Why should you stop accepting new requests during graceful shutdown?
Stopping new requests prevents the server from starting work it can't finish before shutting down, avoiding errors or lost data.
Click to reveal answer
intermediate
How can you ensure all ongoing requests finish before the server closes?
You wait for all current requests to complete, often by tracking active connections and closing the server only after they finish.
Click to reveal answer
intermediate
What is a common method to clean up resources during shutdown in Node.js?
Closing database connections, clearing timers, and releasing file handles are common cleanup steps during shutdown.
Click to reveal answer
Which signal is typically used to trigger graceful shutdown in a Node.js app?
✗ Incorrect
SIGINT is sent when you press Ctrl+C and is commonly used to start graceful shutdown.
What should a server do first when starting graceful shutdown?
✗ Incorrect
Stopping new requests prevents new work from starting during shutdown.
Why is it important to wait for ongoing requests to finish before shutdown?
✗ Incorrect
Waiting ensures requests complete properly without errors.
Which Node.js method helps to stop the server from accepting new connections?
✗ Incorrect
server.close() stops new connections but lets existing ones finish.
What is NOT a typical cleanup task during graceful shutdown?
✗ Incorrect
Opening new sockets is not part of shutdown; it would start new work.
Explain the steps to implement graceful shutdown in a Node.js server.
Think about what happens from signal to process exit.
You got /5 concepts.
Why is graceful shutdown important for a Node.js application?
Consider what happens if the app stops suddenly.
You got /4 concepts.