I am developing an nodejs search application for itunes-search and searching some software information from my local database with express framework. The search module returns information like software name, music name through a single json variable. But now I also need Music artist details/ Software company name through another different json variable. I can simply return the song details with the bellowed code. In client sides:
$scope.search_music_data = function(data)
{
var data="Hamdoon Soft";//Search my favourite artist name or band name
$http({'method' : 'post', url: '/search', data: {'search_item' : data}}).
success(function(data){
$scope.artist_name = data;
}).
error(function(data){
})
$scope.check = true;
}
Bellowed codes are in server sides:
In route.js
app.post('/search', search.search_music);
In search_music function currently this code is working:
ItemName="calculated data Json Data"
var response.send(ItemName);
But I also need send another calculated data like
ItemName="calculated data Json Data"
ArtistName="calculated data Json Data"
var response.send(ItemName, ArtistName);
Or ItemName="calculated data Json Data" SoftWareCompnayName="calculated data Json Data" var response.send(ItemName, SoftWareCompnayName); Is it possible?I will really appreciate him/her if he/she can help me.
Use this in server side code. I think this will help you. This is the example of multiple value sent from server to client.
res.send({artist: artist_details, music: music_details});
In client side :
you can access it data.artist & data.music from angular controller.