2013-10-08 113 views
2

我可以測試一個PhoneJS應用程序與數據綁定到本地node.js數據服務器(運行在localhost:3000,數據庫MongoDB) 它在我的瀏覽器中運行正常Chrome):PhoneJS瓦波紋模擬器無法連接到本地節點服務器

$.get('http://127.0.0.1:3000/Categories') get correctly the data... 

現在嘗試模擬移動設備,我通過Ripple模擬器運行它。該應用程序正確地顯示在模擬器,但沒有當試圖從節點服務器之間的數據....

Failed to load resource: the server responded with a status of 500 (Internal Server Error) https://rippleapi.herokuapp.com/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=http%3A//127.0.0.1%3A3000/Categories 

返回

{ 
    "code": "ECONNREFUSED", 
    "errno": "ECONNREFUSED", 
    "syscall": "connect" 
    } 

我失去了一些重要的參數?

這裏是我的server.js:

var express = require('express'), 
categories = require('./routes/category'), 
products = require('./routes/product'); 

var app = express(); 

cors = require('./cors'); 
app.use(cors); 

// categories 
app.get('/categories/:id', categories.findById); 
app.get('/categories', categories.findAll); 

// products 
app.get('/categories/:id/products', products.findByCategory); 
app.get('/products/:id', products.findById); 
app.get('/products', products.findAll); 

app.listen(3000); 
console.log('Listening on port 3000...'); 

回答

12

紋波仿真器具有默認啓用 「遠程跨域代理」。對於本地主機連接,請在「設置」可摺疊組中將其禁用(或者設置爲本地,如果您的服務不是兼容的,則爲CORS)。

+1

謝謝,它正在運行罰款禁用它,因爲你提到... – erwin

相關問題