node.js multipart/form-data local file upload to api
<p>I want to upload a file to a restful api service from my javascript application. It should use a local path like "c:/folder/test.png" and upload to something like "localhost/uploads", is there a easy approch, I am a little lost coming to the upload part and have tryed searching around, but didn't find any that matched my case, and I have tryed this code below:</p>

<pre><code>    var request = require('request');

    var url = "http://localhost/uploads";
    var req = request.post(url, function (err, resp, body) {
          if (err) {
            console.log('Error!');
          } else {
            console.log('URL: ' + body);
          }
        });

    var form = req.form();

    form.append('file', fs.createReadStream("C:/kristian/Devbeasts-small.png"));
</code></pre>

<p>this code gives me the error: Error: Cannot find module 'request'</p>

<p>It requires a multipart form-data.</p>