-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path4.server.js
More file actions
38 lines (30 loc) · 1.06 KB
/
4.server.js
File metadata and controls
38 lines (30 loc) · 1.06 KB
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
37
38
//javscript was chosen for nodehigh
// because it is throughput low latency event model processing
// library - maps on papers. just a tool on the way
// framework - gps system - pretype location - it gives us the direction, opinion - what you need on the way
// platform - automatic driving google car - strong opinion where it is going, you have to say very little, you can just go with the flow
function handleHTTP(req, res){
if(req.method === "GET"){
if(req.url === "/"){
res.writeHead(200,{"Content-type":"text/plain"});
setTimeout(function(){
var num = Math.random();
setTimeout(function(){
res.end("Hello World"+ num);
},1000);
},1000);
}
else{
res.writeHead(403); //Forbidden
res.end("Get outta here!");
}
}else{
res.writeHead(403); //Forbidden
res.end("Get outta here!");
}
}
var host = "localhost";
var port = 8006;
var http = require("http");
var http_serv = http.createServer(handleHTTP).listen(port, host);
var ASQ = require("asynquence");