0

I'm using express with domain.js middle ware.

I need to be able to shut down the node instance from a request. This is not a public facing instance so security is not really an issue. I am using express to process http request, one of which is a "kill" request. This request should shut down node completely as quickly as possible.

I've tried the following server.close(), but that doesn't seem to do anything.

I would rather shut it down as gracefully as possible, but if I need to kill it I am willing to do that. I don't know how.

3 Answers 3

2

process.exit(exitCode) should do.

Sign up to request clarification or add additional context in comments.

Comments

2

just call process.exit(exitCode), it will exit

Comments

2
app.get('/kill', function(req,res) {
    process.exit(0);
});

The exit code can be anything. But any non-zero value means unclean exit.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.