-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
33 lines (33 loc) · 1023 Bytes
/
app.js
File metadata and controls
33 lines (33 loc) · 1023 Bytes
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
var http = require('http');
var url = require('url');
var fs = require('fs');
var sign = "";
http.createServer(function (req, res) {
console.log("Got Request for " + req.url);
var q = url.parse(req.url, true);
var qdata = q.query;
if (q.pathname == "/connect") {
res.writeHead(200, {'Content-Type': 'text/html'});
}
else if (q.pathname == "/getsign") {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write(sign);
}
else if (q.pathname == "/%0Aconnect") {
res.writeHead(200, {'Content-Type': 'text/html'});
}
else if (q.pathname == "/postsign") {
if (qdata.text) {
res.writeHead(200, {'Content-Type': 'text/html'});
sign = qdata.text
}
else {
res.writeHead(400, {'Content-Type': 'text/html'});
}
}
else {
res.writeHead(404, {'Content-Type': 'text/html'});
}
res.end();
}).listen(1998);
console.log("Ready on port 1998");