[Fixed] NodeJS Capture output of NODEJS Command and Display to express window


NOTE: I do not want to capture the output of a bash command, however a command like:


And it just say 1 on my express server instead of logging it to the console

I am very very new to NodeJs but skilled in python

Here is my code:

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)

I want if I do:


That page will display 1.
How would I do this?


Made it on my own with PHP.

For anyone who needs the code, run this on REPL.IT or HEROKU or of the like.

$lang = $_GET['lang'];
$command = $_GET['cmd'];

if ($lang == 'sh') {
if ($lang == 'python3') {
  System('python3 -c "'.$command.'"');
if ($lang == 'python2') {
  System('python2 -c "'.$command.'"');
if ($lang == 'node14') {
$fp = fopen('cmds.js', 'w');
fwrite($fp, $command);

System('node cmds.js');

Leave a Reply

(*) Required, Your email will not be published