i am writing a code for display the scan result on web server via http but is always gives me errr any one can solve this issue here is my code
var http = require('http');
var wifi = require('node-wifi');
wifi.init({
debug : true,
iface: 'wlan0'
});
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'application/json'});
var otherArray = ["item1", "item2"];
var otherObject = { item1: "item1val", item2: "item2val" };
var json = JSON.stringify({
anObject: otherObject,
anArray: otherArray,
another: "item"
});
wifi.scan(function(networks){
console.log(networks);
});
res.end(json,networks);
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');