mobile.de-api-reader
Simple XML receiver of the mobile.de API.
Just edit config.json and:
var config = require('./config.json'), // config file
xmlApiReader = require('./lib/xmlApiReader'), // receives the XML from the API
eventEmitter = require('events').EventEmitter; // because node.js...
// We won't run without the http settings.
if (!config.api) {
throw new Error("Config is incomplete!");
}
var eventHandler = new eventEmitter;
var xmlReader = new xmlApiReader;
// Set the Event Handler
xmlReader.setApiConfig(config.api);
// Instanciate the API reader
xmlReader.setEventHandler(eventHandler);
// Read the API
xmlReader.readApi();
eventHandler.on('xml_api_read', function(){
// fancy business logic
console.log("awesome!");
});