aboutsummaryrefslogtreecommitdiffstats
path: root/app/comp-fe/httpserv.js
diff options
context:
space:
mode:
authorEran (ev672n), Vosk <ev672n@att.com>2018-08-07 14:15:05 +0300
committerEran (ev672n), Vosk <ev672n@att.com>2018-08-07 14:15:05 +0300
commitb9708a7c3cfaf5767992a2b15180e7b85c459242 (patch)
tree076e19ea52232232e9060a9d7e074947a4a49508 /app/comp-fe/httpserv.js
parentcc32bd38d72e5c1c92048657083952d3e45c1819 (diff)
adding the dcae dt code
Adding DCAE-dt code Change-Id: Id6b779db9d24e10825fb97ad5fd46f41e65e6738 Issue-ID: SDC-1614 Signed-off-by: Eran (ev672n), Vosk <ev672n@att.com>
Diffstat (limited to 'app/comp-fe/httpserv.js')
-rw-r--r--app/comp-fe/httpserv.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/comp-fe/httpserv.js b/app/comp-fe/httpserv.js
new file mode 100644
index 0000000..11bbef4
--- /dev/null
+++ b/app/comp-fe/httpserv.js
@@ -0,0 +1,32 @@
+var http = require("http");
+var url = require("url");
+var fs = require("fs");
+
+http.createServer(function(req, resp) {
+ var file = url.parse(req.url).pathname.substring(1);
+
+ console.log(file);
+ if (!fs.existsSync(file)) {
+ resp.writeHead(404, file + " foundn't");
+ return resp.end();
+ }
+
+ try {
+ fs.readFile(file, function(err, file) {
+ if (err) {
+ throw err;
+ } else {
+ resp.writeHead(200,
+ { 'Access-Control-Allow-Origin' : '*',
+ 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS, PUT, PATCH, DELETE',
+ 'Access-Control-Allow-Headers': 'X-Requested-With,content-type',
+ 'Access-Control-Allow-Credentials': true });
+ resp.write(file);
+ resp.end();
+ }
+ });
+ } catch(e) {
+ resp.writeHead(500,e);
+ resp.end();
+ }
+}).listen(8999);