This commit is contained in:
Joe
2017-02-20 18:39:30 -06:00
parent 847478a845
commit 551aa35587
2 changed files with 8 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
// $Revision: 16 $ -- $Date: 2016-02-08 15:14:12 -0600 (Mon, 08 Feb 2016) $
var http = require('http');
var sys = require('sys');
var sys = require('util');
var fs = require('fs');
var moniFilename = 'abc';
var querystring = require('querystring');
@@ -81,7 +81,7 @@ http.createServer(function(req, res) {
}
} else {
var reqFile=req.url.replace("/wc/","");
console.log("Orig Requested File " + reqFile );
if ((reqFile!=='EventSource.js') && (reqFile!=='autosize.min.js') ) {
reqFile='display.html'
@@ -94,17 +94,17 @@ http.createServer(function(req, res) {
if (reqFile.match(/\.js/gi)) {
contentType="application/javascript";
}
var filePath = __dirname + '/' + reqFile;
console.log("Full path " + filePath + " [" + contentType + "]" );
try {
var stat = fs.statSync(filePath);
var readStream = fs.createReadStream(filePath);
res.writeHead(200, {"Content-Type":contentType});
readStream.pipe(res); // this will do a res.end() by its own.
} catch (ex) {