SkeptiCOM/modules/routage.js

31 lines
598 B
JavaScript
Raw Normal View History

2020-12-12 18:08:49 +01:00
/*
SkeptCOM [IO] | Via un json, on va rediriger qui envoye a quoi
*/
const routes = require('../conf/routes.json')
const skepticonf = require('../conf/skepticom.json')
const services = {}
module.exports = (who) => {
if (!who || !routes[who]) return console.error(`ERROR routage`)
services[who] = require('./skeptIO')(who)
function send(data) {
services[who].send('logs', '', data)
for (let i in routes[who]) {
services[who].send(i, routes[who][i], data)
}
}
function log(data) {
services[who].send('logs', '', data)
}
return {
send,
log
}
}