Skip to content

Commit

Permalink
Clear logs endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
salty2011 committed Jan 15, 2025
1 parent 22a947b commit 93ab5cb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,19 @@ app.post('/api/users/:username/select', async (req, res) => {
}
});

// Clear logs endpoint
app.post('/api/logs/clear', async (req, res) => {
try {
// Clear the log file
fs.writeFileSync(logFile, '');
serverLog('info', 'Logs cleared successfully', 'Server');
res.json({ success: true });
} catch (error) {
serverLog('error', 'Failed to clear logs', 'Server', error instanceof Error ? error.message : String(error));
res.status(500).json({ error: 'Failed to clear logs' });
}
});

// All remaining requests return the React app, so it can handle routing
app.get('*', (req, res) => {
res.sendFile(join(__dirname, '../../dist/index.html'));
Expand Down

0 comments on commit 93ab5cb

Please sign in to comment.