Ask for help on how to use the API of WeChat’s picture uploading function!

  node.js, question
var images = {
 localId: [],
 serverId: []
 };
 
 document.querySelector('#chooseImage').onclick = function () {
 wx.chooseImage({
 count    : 2,
 SizeType: ['compressed'], // You can specify whether it is an original image or a compressed image. By default, there are both
 success : function (res) {
 var localIds = res.localIds;  //Return the localId list of the selected photo. LocalID can be used as src attribute of img tag to display the photo.
 syncUpload(localIds);
 bracket
 });
 };
 
 function syncUpload(localIds){
 var localId = localIds.pop();
 wx.uploadImage({
 localId: localId,
 isShowProgressTips: 1,
 success: function (res) {
 var serverId = res.serverId;  //Return the server-side ID of the picture
 images.serverId.push(serverId);
 $('.message').append(serverId);
 if(localIds.length > 0){
 syncUpload(localIds);
 bracket
 
 viewImage(images.serverId);
 bracket
 });
 };
 
 function viewImage(serverIds){
 var i = 0, len = serverIds.length;
 
 //What should I do here to preview the uploaded picture?
 bracket

var img = new Image();

img.src = res.localIds;
 
 img.onload=function(){
 $('.message').append(img);
 };