Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Node.js is a server-side environment for JavaScript. To interact with it from a web page, you'll want to establish an <a href="http://nodejs.org/api/http.html" rel="nofollow noreferrer"><code>http.Server</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest" rel="nofollow noreferrer">use Ajax</a> to communicate between.</p> <p>A partial example (using a few libraries to simplify) would be:</p> <pre><code>// server-side app.post('/append', function (req, res) { exec('appand.bat', function (err, stdout, stderr) { if (err || stderr.length) { res.send(500, arguments); } else { res.send(stdout); } }); }); </code></pre> <pre><code>// client-side function call() { $.post('/append').done(function (ls) { console.log(ls); }).fail(function (xhr) { console.error(xhr.responseText); }); } </code></pre> <p>The libraries demonstrated are <a href="http://expressjs.com/" rel="nofollow noreferrer">Express</a> for server-side and <a href="http://jquery.com/" rel="nofollow noreferrer">jQuery</a> for client-side. It also uses <a href="http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback" rel="nofollow noreferrer"><code>child_process.exec()</code></a> rather than <code>spawn()</code> to get <code>Buffer</code>s rather than <code>Stream</code>s.</p> <p>Resources:</p> <ul> <li><a href="http://learn.jquery.com/" rel="nofollow noreferrer">Learn jQuery</a></li> <li><a href="http://expressjs.com/guide.html" rel="nofollow noreferrer">Express Guide</a></li> <li><a href="https://stackoverflow.com/tags/node.js/info">SO's <code>node.js</code> Tag Info</a>, which includes a number of "<em>Tutorials, Guides and Books</em>" and "<em>Free Node.js Books and Resources</em>."</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload