How to return image url using multer
<p>I just started with node. I want to upload the image to the server, I am using multer for an image upload. I am using below code and I am able to upload the images to the server, but not able to send the image url back to the client as success response. Any help will be appreciated.</p>
<pre><code>var request = require('request');
var app = require('../app');
var util = require('../response_util');
var multer  =   require('multer');
var storage =   multer.diskStorage({
  destination: function (req, file, callback) {
    callback(null, 'public/upload');
  },
  filename: function (req, file, callback) {
    var imageUrl = file.fieldname + '-' + Date.now()+'.jpg';
    callback(null, imageUrl);
  }
});
var upload = multer({ storage : storage }).single('image');

app.get('/img/home',function(req,res){
    res.send(&quot;welcome to image home&quot;);
});

app.post('/img/upload',function(req,res) {
    upload(req,res,function(err,result) {
    console.log(err);
    console.log(result);
        if(err) {
            return res.end(&quot;Error uploading file.&quot;+err);
        }
        res.end(&quot;File is uploaded url : &quot;+result);
    });
});
</code></pre>