-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
38 lines (28 loc) · 1.03 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var fs = require("fs");
var http = require("http");
var url = require("url");
http.createServer(function (request, response) {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname + " Received.");
response.writeHead(200);
console.log('Read Begin for'+pathname)
if(pathname == "/") {
html = fs.readFileSync("demo.html", "utf8");
sign = response.write(html);
console.log('Read html is '+sign)
} else if (pathname == "/build/webgazer.js") {
script = fs.readFileSync("webgazer.js", "utf8");
//console.log("Script");
sign = response.write(script);
console.log('Read webgazer.js is'+sign);
}else if (pathname == "/stroke.js") {
script = fs.readFileSync("stroke.js", "utf8");
//console.log("Script");
sign = response.write(script);
console.log('Read stroke.js is'+sign);
}else{
console.log('Nothing for '+pathname+' is read');
}
response.end();
}).listen(8000);
console.log("Listening to server on 8000...");