Sunday 15 February 2015

jquery - getJSON for NodeJS API answer -



jquery - getJSON for NodeJS API answer -

i learning nodejs now. have next javascript code project:

$.getjson('/api/' + entry + '/', function(data) { if ( data.hasownproperty("seq") ) { $(placement).append( data.seq ); } });

it theoretically gets reply express nodejs api, running @ specific port xxxx. api can accessed via localhost:xxxx/api/whateverentry.

the question is: how code know port should go?

this default current port beingness visited in browser beingness used because relative url. if different host not specified, base of operations of url used.

for illustration if running on port 4000 on localhost, going http://localhost:4000/api/... same request above.

jquery node.js express

No comments:

Post a Comment