4
1
Fork 0
This repository has been archived on 2019-02-05. You can view files and clone it, but cannot push or open issues or pull requests.
Shakes_and_Fidget/index.js

35 lines
909 B
JavaScript
Raw Normal View History

2018-02-19 22:59:28 +00:00
var app = require('express')();
var http = require('http').Server(app);
var request = require('request');
var url = 'http://192.168.178.109:1024/';
// Host the HTML File
app.get('/', function(req, res){
//name, class, experience, gold, level
request({
url: url,
json: true,
auth: {
user: 'Simon',
pass: 'password'
}
}, function(error, response, body){
var data = [];
if (!error && response.statusCode === 200) {
body.response.bot.accounts.forEach(el => {
data.push(el[Object.keys(el)]);
});
// Use fetched Data
data.forEach(el => {
console.log(el.class);
});
res.sendFile(__dirname + '/index.html');
} else console.error('HTTP ERROR ' + response.statusCode + '');
});
})
app.listen(80);