SkeptiCOM/modules/routage.js

31 lines
628 B
JavaScript
Raw Normal View History

2020-12-09 21:19:58 +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
}
}