Explorar el Código

fix response message

Ray Lee hace 5 años
padre
commit
1fa2a701bb
Se han modificado 1 ficheros con 8 adiciones y 4 borrados
  1. 8 4
      server/api/index.js

+ 8 - 4
server/api/index.js

@@ -3,14 +3,18 @@ const router = express.Router();
 const exec = require('child_process').exec;
 
 router.post('/hi', (req, res) => {
-  var yourscript = exec('sh ./server/lib/xfdftool/bin/xfdftool',
+  var command = exec('./server/lib/xfdftool/bin/xfdftool',
     (error, stdout, stderr) => {
       if (error !== null) {
         res.status(500);
         res.json({
-          error: error,
-          stdout: stdout,
-          stderr: stderr
+          error_message: stderr
+        });
+      }
+      else {
+        res.status(200);
+        res.json({
+          data: stdout,
         });
       }
     });