From a725a6a0859f7cca8d6a23e1b290266cbd35eaa8 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 20 Jun 2022 14:59:46 +0200 Subject: [PATCH] Updating the NodeJS Example By moving the new line character outside of the JSON statement, the server will no longer render the closing quotation mark (") and curly bracket (}) on a new line causing the JSON output to be invalid. --- node-js-demo/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node-js-demo/app.js b/node-js-demo/app.js index b6938a8..0a55137 100644 --- a/node-js-demo/app.js +++ b/node-js-demo/app.js @@ -4,9 +4,9 @@ const server = http.createServer((req, res) => { res.setHeader("Content-Type", "application/json"); res.writeHead(200); - res.end(`{ "status": "success", "message": "You're reading The NGINX Handbook!\n" }`); + res.end(`{ "status": "success", "message": "You're reading The NGINX Handbook!" }\n`); }); server.listen(3000, 'localhost', () => { console.log('running on http://localhost:3000/'); -}); \ No newline at end of file +});