SkeptiCOM/modules/routage.js
2020-12-12 18:10:14 +01:00

31 lines
598 B
JavaScript

/*
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
}
}