Unable to load customer list
Closed this issue · 4 comments
Hi Dan,
I stared node server.js and verified the api/dataservice is OK http://localhost:3000/api/dataservice
I tried to run debug mode in visual studio for the front end however it could not load the customers list due to it was trying to locate the server location on http://localhost:51511/api/dataservice
I tried to open the customersService.js and modified the var serviceBase = '/api/dataservice/' to var serviceBase = 'http://localhost:3000/api/dataservice/'. It throws the exception on XMLHttpRequest cannot load ... Origin is not allowed by Access-Control-Allow-Origin.
Google and I found plenty of solution however I can only manage to fix the GET API e.g able to load customer data by adding Access-Control-Allow-Origin", "*" to server.js.
I could not fix the POST API for the authService.js
Please advise the solution for this.
Thanks
Thomas.
Hi Thomas. Everything works out of the box without any changes so something isn't quite right there. No need for cross-origin files, etc. If you're running it with Node.js (and ran through the steps for Mongo and npm) then you should be able to fire up Node.js and then hit the app in the browser. Only port 3000 is used for the Node.js option - not sure where the 51511 port is coming from since that's not something the app uses.
If you want to run it in Visual Studio you can load it and press F5 and it'll run. If you want to use Node.js then VS isn't needed at all (and you wouldn't start it - would mess things up) and you would just start up the Node.js server as shown in the readme. If Node is throwing any specific errors let me know but it should definitely fire right up if you ran through the readme steps.
Hi Dan
The port 51511 come from iis express when you hit
Thomas
On 27/11/2014 12:14 PM, "Dan Wahlin" notifications@github.com wrote:
Hi Thomas. Everything works out of the box without any changes so
something isn't quite right there. No need for cross-origin files, etc. If
you're running it with Node.js (and ran through the steps for Mongo and
npm) then you should be able to fire up Node.js and then hit the app in the
browser. Only port 3000 is used for the Node.js option - not sure where the
51511 port is coming from since that's not something the app uses.If you want to run it in Visual Studio you can load it and press F5 and
it'll run. If you want to use Node.js then VS isn't needed at all (and you
wouldn't start it - would mess things up) and you would just start up the
Node.js server as shown in the readme.—
Reply to this email directly or view it on GitHub
#21 (comment)
.
Ah - based on the start of your comment I was assuming you were only using Node.js (VS only for debugging it sounded like). If you're running it direct through Visual Studio (IIS) then it'll take care of everything and you should be able to open the solution and press F5 to have it run (just re-verified that works as expected).
If you want to run it through Node.js then you won't use VS at all (or IIS) and you'll have to start the Node.js server as shown in the readme.
You basically need to choose one or the other since I offer two options there for the backend. That would explain the cross-origin issue. You won't get that if you run specifically in Node.js or specifically in VS.
Hi Dan,
It worked perfectly, thank you for your help.
Thomas.