feat: show member details
This commit is contained in:
19
index.js
19
index.js
@@ -58,6 +58,25 @@ app.get('/api/node/status', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Proxy endpoint to get status from a specific node
|
||||
app.get('/api/node/status/:ip', async (req, res) => {
|
||||
try {
|
||||
const nodeIp = req.params.ip;
|
||||
|
||||
// Create a temporary client for the specific node
|
||||
const nodeClient = new SporeApiClient(`http://${nodeIp}`);
|
||||
const nodeStatus = await nodeClient.getSystemStatus();
|
||||
|
||||
res.json(nodeStatus);
|
||||
} catch (error) {
|
||||
console.error(`Error fetching status from node ${req.params.ip}:`, error);
|
||||
res.status(500).json({
|
||||
error: `Failed to fetch status from node ${req.params.ip}`,
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Start the server
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on http://localhost:${PORT}`);
|
||||
|
||||
Reference in New Issue
Block a user