user762579
user762579

Reputation:

PhoneJS w Ripple simulator cannot connect to local node server

I ma trying to test a PhoneJS app with data bound to a local node.js data server ( running at localhost:3000, database MongoDB ) it's running fine in my browser ( Chrome ):

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

Trying now to simulate a mobile device, I am running it via Ripple simulator. The app displays correctly in the simulator, but fails when trying to get the data from the node server....

 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

returning

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

AM I missing some important parameter ?

here is my 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...');

Upvotes: 2

Views: 2812

Answers (1)

amartynov
amartynov

Reputation: 4175

Ripple emulator has "Remote cross domain proxy" enabled by default. For localhost connections, disable it in the "Settings" collapsible group (or set to Local, if your service is not CORS-compatible).

Upvotes: 11

Related Questions