From f70db0904a69f311da5d0e58de69d72c94a2e5aa Mon Sep 17 00:00:00 2001 From: Sagar Date: Sat, 22 Sep 2018 00:38:30 +0530 Subject: [PATCH] created module.js and updated index.js --- index.js | 6 ++++-- module.js | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 module.js diff --git a/index.js b/index.js index 45aa965..65a3694 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,11 @@ const http = require('http'); const url = require('url'); +const newModule = require('./module.js'); const app = http.createServer((request,response) => { var querystring querystring = url.parse(request.url,true).query; - if (querystring) { + if (querystring.value) { response.writeHead(200, {"Content-Type": "text/html"}); console.log('the index.js has loaded') response.write(`

The parsed value from the url is ${querystring.value}

`); @@ -12,7 +13,8 @@ const app = http.createServer((request,response) => { } else { - response.write(`

No values were passed

`); + response.write(`

No values were passed check your terminal/command prompt for log message.

`); + newModule.addlog(); response.end(); } diff --git a/module.js b/module.js new file mode 100644 index 0000000..4cd15d9 --- /dev/null +++ b/module.js @@ -0,0 +1,4 @@ +/* module.js */ +exports.addlog = () => { + console.log(` module.js has loaded`) +} \ No newline at end of file