UNPKG

ndut-socket-io

Version:
13 lines (12 loc) 386 B
module.exports = async function (socket) { const { _, fastGlob, getConfig, getNdutConfig } = this.ndut.helper const config = getConfig() for (const n of config.nduts) { const cfg = getNdutConfig(n) const files = await fastGlob(`${cfg.dir}/ndutSocketIo/middleware/*.js`) for (const f of files) { const fn = require(f) socket.use(fn) } } }