@Berny23 thanks for a great job with this.
If you allow me a suggestion, could you add a button to shutdown the toypad machine (debian)?
I try with this code and work for me:
Change in /index.js
// ---------------------Begin of shutdown----------------------------------------------------
// Importa el módulo 'child_process' para ejecutar comandos del sistema
const { exec } = require('child_process');
// ...
// Ruta para apagar el sistema
app.post('/shutdown', (request, response) => {
// Ejecuta el comando para apagar el sistema
exec('sudo shutdown -h now', (error, stdout, stderr) => {
if (error) {
console.error(Error al apagar el sistema: ${error.message});
response.status(500).send('Error al apagar el sistema');
return;
}
console.log(Sistema apagado: ${stdout});
response.send('El sistema se está apagando...');
});
});
// ---------------------End of shutdown----------------------------------------------------
@Berny23 thanks for a great job with this. If you allow me a suggestion, could you add a button to shutdown the toypad machine (debian)? I try with this code and work for me:
Change in /index.js // ---------------------Begin of shutdown---------------------------------------------------- // Importa el módulo 'child_process' para ejecutar comandos del sistema const { exec } = require('child_process');
// ...
// Ruta para apagar el sistema app.post('/shutdown', (request, response) => { // Ejecuta el comando para apagar el sistema exec('sudo shutdown -h now', (error, stdout, stderr) => { if (error) { console.error(
Error al apagar el sistema: ${error.message}
); response.status(500).send('Error al apagar el sistema'); return; } console.log(Sistema apagado: ${stdout}
); response.send('El sistema se está apagando...'); }); });// ---------------------End of shutdown----------------------------------------------------
Change in /server/index.html
Again, thanks for all! GASPOPI