log requests
All checks were successful
Publish Docker Images / docker (push) Successful in 1m17s

This commit is contained in:
Lee 2023-11-16 14:32:18 +00:00
parent 4a3c26b7fa
commit 58645ec2b2
2 changed files with 7 additions and 2 deletions

@ -22,7 +22,7 @@ export default class NodeManager {
* @returns the node * @returns the node
*/ */
getRandomNode() { getRandomNode() {
const randomIndex = Math.floor(Math.random() * this.nodes.length); const index = Math.floor(Math.random() * this.nodes.length);
return this.nodes[randomIndex]; return this.nodes[index];
} }
} }

@ -37,6 +37,11 @@ export default class ProxyRoute extends Route {
return; return;
} }
// Log the request
console.log(
`[${response.headers["X-Proxy-Node"]}] ${url} - ${response.status}`
);
// Return the JSON response // Return the JSON response
res.status(response.status).set(response.headers).json(data); res.status(response.status).set(response.headers).json(data);
} catch (ex: any) { } catch (ex: any) {