2016-03-06 76 views
1

我對node.js非常陌生,但我使用它從API獲取數據。我想將響應數據返回給我的客戶端js進行操作並注入到html頁面中。那裏有非常基本的想法,現在我可以從客戶端向我的node.js發出一個HTTP請求來檢索JSON響應文本嗎?在這種情況下,客戶端和服務器端如何與海誓山盟進行通信?客戶端js獲取node.js API調用

factual.get(/t/places-us, {filters:{"locality":"seattle"}, {category_ids:{"$includes_any":[48, 50, 52]}}}, function (error, res) { 
    console.log(res.data); 
}); 

回答

0

您可以使用像express這樣的框架。

添加路線以處理您的客戶請求。

然後使用您的API響應來構建響應。