Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

External servers posting to angular 2 routes

Tags:

angular

If paypal or facebook tries to post data to your angular 2 routes, how do you access that post data? How do you see the HTTP headers submitted to your angular 2 route with a http request?

like image 838
seanEd Avatar asked Oct 30 '22 12:10

seanEd


1 Answers

You won't ever see the POST data in your Angular app. Why? Because Angular is running inside of the browser when the POST requests are coming to the server. Usually your server just rewrites all (or almost all) incoming requests to your index.html and Angular by parsing the URL knows which state to show.

In other words, your POST data is received on your server but not passed through. You can catch it at the moment of rewriting and pass the data in some way (print it inside of HTML, set as cookies, etc) to your Angular app.

If I was choosing the way to pass the data I would prefer to just store the POST data in a database under some ID and then redirect the browser to the Angular app with a get parameter telling to pick the data under the specified ID.

like image 137
smnbbrv Avatar answered Nov 15 '22 05:11

smnbbrv