2016-08-12 26 views
0
let post = 
{ 
    method: 'POST', 
    path: '/posts/new/{postType}', 
    handler: (request, reply) =>{ 
     //when params is text 
    if (request.params.postType == "text") 
    { 
    return reply("successfully uploaded text post"); 
    } 
    //when params is image 
    else (request.params.postType == "image") 
    { 
    //call proxy uri to save the image 
    /*proxy: 
    { 
     uri: proxyUri + '/post/image', //call proxy uri to save the image 
     passThrough: true, 
     acceptEncoding: false, 
     }*/ 
    } 
} 

我如何有條件地調用基於路由參數的代理服務器,所以我使用一個休息api文本,圖像,vides等?如何根據路由參數有條件地調用代理服務器?

回答

相關問題