You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
883 B
JavaScript
25 lines
883 B
JavaScript
9 months ago
|
const { domain } = require('../config').server;
|
||
|
const { isEmpty } = require('../utils/commons.util');
|
||
|
const { getConnection } = require('../services/connections.service');
|
||
9 months ago
|
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));
|
||
9 months ago
|
// const { waisession } = ctx.headers;
|
||
|
// if (isEmpty(waisession)) {
|
||
|
// await next();
|
||
|
// } else {
|
||
|
// const findSession = await getConnection({ sesson_id: waisession, connect_domain: domain });
|
||
|
// if (!isEmpty(findSession)) {
|
||
|
// // todo: 设置一个flag, 是否存在, 不用再查一遍
|
||
|
// }
|
||
|
// }
|
||
|
await next();
|
||
9 months ago
|
// todo: forward to target server
|
||
|
|
||
|
console.log('forward End ---------------');
|
||
|
} catch (err) {}
|
||
|
};
|