This repository has been archived by the owner on Jun 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
105 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,4 @@ NodeReport*.txt | |
npm-debug.log | ||
nodereport-*.tgz | ||
nodereport_test.log | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
// Example - generation of NodeReport via API call | ||
'use strict'; | ||
|
||
var nodereport = require('nodereport'); | ||
var http = require("http"); | ||
var http = require('http'); | ||
|
||
var count = 0; | ||
|
||
function my_listener(request, response) { | ||
switch(count++) { | ||
case 0: | ||
response.writeHead(200,{"Content-Type": "text/plain"}); | ||
response.write("\nRunning NodeReport API demo... refresh page to trigger NodeReport"); | ||
response.end(); | ||
break; | ||
case 1: | ||
response.writeHead(200,{"Content-Type": "text/plain"}); | ||
// Call the nodereport module to trigger a NodeReport | ||
var filename = nodereport.triggerReport(); | ||
response.write("\n" + filename + " written - refresh page to close"); | ||
response.end(); | ||
break; | ||
default: | ||
process.exit(0); | ||
switch (count++) { | ||
case 0: | ||
response.writeHead(200, {'Content-Type': 'text/plain'}); | ||
response.write('\nRunning NodeReport API demo... refresh page to ' + | ||
'trigger NodeReport'); | ||
response.end(); | ||
break; | ||
case 1: | ||
response.writeHead(200, {'Content-Type': 'text/plain'}); | ||
// Call the nodereport module to trigger a NodeReport | ||
var filename = nodereport.triggerReport(); | ||
response.write('\n' + filename + ' written - refresh page to close'); | ||
response.end(); | ||
break; | ||
default: | ||
process.exit(0); | ||
} | ||
} | ||
|
||
var http_server = http.createServer(my_listener); | ||
http_server.listen(8080); | ||
|
||
console.log('api_call.js: Node running'); | ||
console.log('api_call.js: Go to http://<machine>:8080/ or http://localhost:8080/'); | ||
console.log('api_call.js: Go to http://<machine>:8080/ or ' + | ||
'http://localhost:8080/'); | ||
|
||
setTimeout(function(){ | ||
setTimeout(function() { | ||
console.log('api_call.js: test timeout expired, exiting.'); | ||
process.exit(0); | ||
}, 60000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters