javascript - Deployd - Data retrieved via AngularJS CORS -


I'm currently reading by Adam Freeman through "Pro Nuts" when going through instances, they have reader With a deparited server resource, using angler (of course) make a sports store app. Deployment resource has been established to bring JSON data coming in this model. I am using NodesJS to run my server. It is currently set to port 5000 ( http: // localhost: 5000 / sportsstore / app.html ) Deployed resource port 5500 ( Http: // localhost: 5500 / products ). When deployed, the response is as follows: [{"name": "kayak", "description": "a boat for one person", "category": "watersports," " Price ":" price ": 48.95," id ": 275," id ":" a1c999fc248b2959 "}, {" name ":" lifejacket "," description ":" protective and fashionable "," category ":" watersports " : "Soccer", "Price": 19.5, "ID": "61303717cfad182e"}, "Soccer Ball", "Details": "FIFA-Approved Size and Weight", "Category": "Soccer" "0fb5f67bdcbd992f" "" "" "" "" "," Corner Flex "," Details ":" On one side of your playing field "Flat" 35,000-seat stadium "," category ":" category ":" soccer "," value ": 34.95," id ":" 24385d315dd388b4 "}," "stadium", "description" : "Ideas": "Ideas", "Details": "Improve your brain efficiency up to 75%," "Soccer", "price": "price": 79500, "id": "500fb6805905a856"}, {"name" Category: "Chess", "Value": 16, "id": "637d8a1f42e6fa1c"}, {"name": "Unstable Chair", "Description": "Secretly your" intelligent "," category ":" Chess "," value ": 29.95," id ":" 733 93312ec7dfab7 "}, {" name ":" human chase board "," description ":" A fun game for the family "The name": "Bling-bling king", "description": "Gold-plated, Hero-stud king", "Chess", "Price": 75, "ID": "7871d02a662b0915"}, {"name" "," Class ":" chess "," price ": 1200," id ":" b 59a3389a0e248bd "}]

I used this code to access $ http .get :

  $ http.get ("http: // localhost: 5500 / product") .Service (data) { ...}) Terror (function (error) {...});  

However, this is returning an error:

  XMLHttpRequest http: // localhost can not load: 5500 / Products on the requested resource 'Access' -Control-Permission-Origin 'header does not exist Origin' http: // localhost: 5000 'Therefore entry is not allowed  

Research suggests that something with Angular and CORS There were issues, and the header had to be configured to run cross-domain requests. As a result, I added the following to my app.config:

  $ http.defaults.useXDomain = true; Delete $ Http.defaults.headers.common ['X-Requested-With']; // It is not necessary anymore, but it has only been kept as a minor case  

Despite adding these settings, I'm still getting the error saying the deployment document Is that it is automatically configured for CORS () and as long as the request does not contain invalid custom headers, the appropriate header information will be sent. I'm pretty sure that my request does not have invalid custom titles:

  Accept: Application / Jason, Text / plain, * / * Cash-Control: Max-age = 0 Origin: / / Localhost: 5000 referrers: http: // localhost: 5000 / sportstore / app.html user-agent: Mozilla / 5.0 (Windows NT 6.3; WOW64) Apple WebKat / 537.36 (KHML, like GECO) Chrome / 34.0.1847.131 Safari / 537.36  

My question: whether to process CORS request I need some configuration to configure Dipliked to Umti? The book does not specify any special angular header settings or some other.

Upgrade your version upgrade to BIC, version 0.6.10. It was the trick for me I was able to process a request now. It does not seem that this is an error with the British King's Code and Adam Freeman's book.

In the book, he mentions that he has included a deployment program with source code download. This version is 0.6.9. I'm sure it works fine with it. It will be easier to try to find the 0.6.10 version. Whatever I have done, you need that version, here it is:

This is not an installer, so you have to paste it into your deployd directory, node_modules .


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -