jurisv/nodejs.extdirect

Incorrect URL for /direct

Closed this issue · 1 comments

I'm trying to replicate the example in the readme. I think I have found a bug in this Node Ext.Direct implementation which occurs when the Sencha Touch 2 client is not in the same location as the node server.

After I try and call my client function to execute a server call(ie. ExtRemote.DXTest.testMe()), I get the following error in Web Inspector for my app:
file://localhost/direct?_dc=1376962496490

What I believe is happening here is that /directapi is returning the wrong url value since it assumes the client and node server are in the same location. Attempts to fix it so that it returns the correct url in the following way results in an error:

app.get('/directapi', function(request, response) {
var api = extdirect.getAPI(EXTDIRECT_NAMESPACE, EXTDIRECT_API_NAME, 'http://localhost:3000'+EXTDIRECT_PATH,
EXTDIRECT_PREFIX);
response.writeHead(200, {'Content-Type': 'application/json'});
response.end(api);
});

Here is the error:
Error: ENOENT, no such file or directory '/Users/user/projects/Network/server/NodeServer/http:/localhost:3000/direct'

Fixed with feature #7