title: Using a sh script to send node js server requests with specified query parameters on the URL
body: <p>I'm a little lost right now on how to get started on my current project. I really just need some help at just getting it going and I should be able to take it from there. I have some experience with JavaScript, php, and mysql but almost nothing in node js.</p>
  
  <p>I have a .sh script file that looks something like this:</p>
  
  <pre><code>curl localhost:3000/signup?user=jack\&amp;height=6\&amp;time=0
  curl localhost:3000/arm?left=0.000000\&amp;right=0.000000\&amp;time=0 --cookie "USER=jack"
  curl localhost:3000/echo?dist=9.220000\&amp;time=10 --cookie "USER=jack"
  curl localhost:3000/line?l1=1\&amp;l2=1\&amp;l3=1\&amp;time=20 --cookie "USER=jack"
  curl localhost:3000/other?ir=0\&amp;time=30 --cookie "USER=jack"
  </code></pre>
  
  <p>I want to send my node js server requests with these specified query parameters in the shell but I have no clue how to do so. Here is my node js code thus far:</p>
  
  <pre><code>const { exec } = require('child_process');
  var script = exec('myscript.sh' ,
          (error, stout, stderr) =&gt; {
             console.log(stdout);
             console.log(stderr);
             if ( error !== null ) {
                console.log(`exec error: ${error}`);
              }
          });
  
  var http = require('http');
  var url = require('url');
  
  http.createServer(function(req, res) {
            var q = url.parse(req.url, true).query;
            res.writeHead(200, {'Content-Type' : 'text/html'});
            res.end("user " + q.first + " height " + q.second);
         }).listen(3000);
  </code></pre>
  
  <p>When I go to localhost:3000 I can see "user undefined height undefined" and when I type "node file.js" into my command line then I get the script to start echoing each line in the linux command line... But how do I put the two together? How would I parse a script or use that script to send the requests that I need to my node js server? I really just have no idea where to begin on this project. Would things be easier simply using php and mysql? Thanks for any help I can get with this. Thanks.</p>