Skip to content

Commit

Permalink
created module.js and updated index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagar authored and Sagar committed Sep 21, 2018
1 parent db8c6ef commit f70db09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
@@ -1,18 +1,20 @@
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(`<h1>The parsed value from the url is ${querystring.value}</h1>`);
response.end();
}

else {
response.write(`<h1>No values were passed</h1>`);
response.write(`<h1>No values were passed check your terminal/command prompt for log message.</h1>`);
newModule.addlog();
response.end();
}

Expand Down
4 changes: 4 additions & 0 deletions module.js
@@ -0,0 +1,4 @@
/* module.js */
exports.addlog = () => {
console.log(` module.js has loaded`)
}

0 comments on commit f70db09

Please sign in to comment.