const { domain } = require('../../config').server; const { isEmpty } = require('../../utils/commons.util'); const { getConnection } = require('../../services/connections.service'); const axios = require('axios'); module.exports = async (ctx, next) => { try { console.log('forward start ---------------'); // console.log(/^\/wai-server\/v\d{1}\/(?!channels|messages)/.test(ctx.path)); const { waisession } = ctx.headers; const findSession = await getConnection({ sesson_id: waisession, status: 'open' }); if (!isEmpty(findSession) && findSession.connect_domain === domain) { await next(); } // todo: forward to target server console.log('forward End ---------------'); } catch (err) {} };