From 78a113146b69c015194ef05aa64e624647781369 Mon Sep 17 00:00:00 2001 From: Babajide Fowotade Date: Sun, 25 Sep 2016 21:00:28 +0100 Subject: [PATCH] Update nodeJS code to supported es6 version LTS Nodejs now support some es6 features, on it's latest stable version 4.5. https://nodejs.org/dist/latest-v4.x/docs/api/synopsis.html --- docs/hellonode.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/hellonode.md b/docs/hellonode.md index e489927aff..df3106c83c 100755 --- a/docs/hellonode.md +++ b/docs/hellonode.md @@ -59,13 +59,13 @@ The first step is to write the application. Save this code in a folder called "` #### server.js ```javascript -var http = require('http'); -var handleRequest = function(request, response) { +const http = require('http'); +const handleRequest = (request, response) => { console.log('Received request for URL: ' + request.url); response.writeHead(200); response.end('Hello World!'); }; -var www = http.createServer(handleRequest); +const www = http.createServer(handleRequest); www.listen(8080); ``` @@ -88,7 +88,7 @@ Next, create a file, also within `hellonode/` named `Dockerfile`. A Dockerfile d #### Dockerfile ```conf -FROM node:4.4 +FROM node:4.5 EXPOSE 8080 COPY server.js . CMD node server.js