diff --git a/README.md b/README.md index b84b3924e..b40e992f0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Node Hello World -Simple node.js app that servers "hello world" +A simple node.js app that prints "hello world" Great for testing simple deployments to the cloud diff --git a/index.js b/index.js index 54e5fef1f..c6038f43c 100644 --- a/index.js +++ b/index.js @@ -10,3 +10,11 @@ const server = http.createServer((req, res) => { server.listen(port, () => { console.log(`Server running on http://localhost:${port}/`); }); + +process.on('unhandledRejection', err => { + console.log('UNHANDLED REJECTION! 💥 Shutting down...'); + console.log(err.name, err.message); + server.close(() => { + process.exit(1); + }); +});