-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.js
30 lines (21 loc) · 815 Bytes
/
web.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
var dnsDB = require('./dnsDB.js');
var http = require('http');
var url = require('url');
//create a server object:
http.createServer(function (req, res) {
urlObject = url.parse(req.url, true);
var data = dnsDB('storage2.db.dellol.io', "key", false, function ( db ){
db.serialize(function() {
res.writeHead(200, {"Content-Type":"text/html"});
db.each("SELECT * FROM content", function(err, row) {
if(err)
res.write(err);
if(row)
res.write(row.field_id + " | " + row.name + " | " + row.value + "<br />");
});
db.exec("", function () {
res.end(); //end the response
});
});
});
}).listen(80);