changed ths script to spawn in the index.js
[VSoRC/.git] / src / routes / index.js
index 3eb3ba46af1fda3a62c288f6d4dd67b4be69e52d..70758258231c1c6092ebfaeed0b650927854249a 100644 (file)
@@ -61,5 +61,27 @@ router.get('/ifstat', (req, res) => {
   });
 });
 
+router.get('/gettopo', (req, res) => {
+  var sys = require('sys')
+  var exec = require('child_process').exec;
+  var child;
+  child = exec("curl localhost:8080/topology", function(error, stdout, stderr) {
+    console.log("gettopo");
+    res.send(stdout);
+  });
+});
 
+router.get('/startcontroller', (req, res) => {
+  var sys = require('sys')
+  var exec = require('child_process').spawn;
+  var child;
+  chlid = spawn('python', ['-f','./../pypy.py']);
+
+    pyProg.stdout.on('data', function(data) {
+
+        console.log(data.toString());
+        res.write(data);
+        res.end('end');
+  });
+});
 module.exports = router;