401 unauthorized in NodeJS
<p>I'm developing an application on MEAN stack which can upload an image from disk on application or we can send a image using chrome extension. Now I have done uploading an image from disk but when I'm trying to send image using chrome extension. On this url  <strong>"<a href="http://localhost:9000/api/look/upload" rel="nofollow">http://localhost:9000/api/look/upload</a>";</strong>  <a href="https://i.stack.imgur.com/Gdcsa.png" rel="nofollow">It gives an error 401 unauthorized</a> </p>

<p>I'm attaching <strong>Route.js</strong> code, if any MEAN stack developer guide me where exactly is error? I will upload file as well. Thank You in advance </p>

<pre><code>    /**
 * Main application routes
 */

'use strict';

var errors = require('./components/errors');
var auth = require('./auth/auth.service');
var path = require('path');

module.exports = function(app) {

  // Insert routes below
  app.use('/api/users', require('./api/user'));
  app.use('/auth', require('./auth'));

  app.use('/api/look', require('./api/look'));
  app.use('/api/links', require('./api/imgScraper'));
  app.use('/api/comments', require('./api/comments'));

  app.post('/forgotpassword', require('./forgotpassword').reset);

  // All undefined asset or api routes should return a 404
  app.route('/:url(api|auth|components|app|bower_components|assets)/*')
   .get(errors[404]);


  app.route('/*')
    .get(function(req, res) {
      res.sendFile(path.resolve(app.get('appPath') + '/index.html'));
    });
};

module.exportstest = function(app) {

  app.use('/api/looktest', require('./api/looktest'));

};


JSON CODE Is here: 

 JSON CODE:
    {
      "name": "IBR Extension",
      "version": "1.3",
      "description": "Demonstrate screenshot functionality in the chrome.tabs api.",
      "background": {
        "persistent": false,
        "scripts": ["ExtensionWorking.js"]
      },
      "browser_action": {
        "default_icon": "camera.png",
        "default_title": "Take a screen shot!"
      },
      "permissions": [
         "tabs",
        "activeTab",
        "downloads",
        "&lt;all_urls&gt;"
      ],
      "manifest_version": 2
    }

XHR code is here:



     function reportBug(){
        var imageData = document.getElementById("canvas").toDataURL();
        var xhttp = new XMLHttpRequest();
        var params = "imageData=" + imageData;
        var url = "http://localhost:9000/api/look/upload";
        xhttp.open( "POST", url, true ); // false for synchronous request
        xhttp.send( params );
        return xhttp.responseText;
    }


Upload function is here:

    exports.upload = function(req, res) {
    console.log('abc');
  var newLook = new Look();
  var fileimage = req.middlewareStorage.fileimage;

  console.log(req.body + "test test");
  newLook.image = '/assets/images/uploads/' + fileimage;
  newLook.email = req.body.email;
  newLook.linkURL = req.body.linkURL;
  newLook.title = req.body.title;
  newLook.description = req.body.description;
  newLook.userName = req.body.name;
  newLook._creator = req.body._creator;
  newLook.createTime = Date.now();
  newLook.upVotes = 0;

  newLook.save(function(err, look) {
    if(err) {
      console.log('error saving look');
      return res.send(500);
    } else {
      console.log(look);
      res.status(200)
           .send(look);
    }
  });
}; 
</code></pre>