GoogleCloudPlatform / terraform-mean-cloudrun-mongodb

Apache License 2.0
15 stars 5 forks source link

demo app sometimes displays raw api response #17

Open bleything opened 2 years ago

bleything commented 2 years ago

A few times today I've noticed that after I add an employee to the demo app sometimes it will show me the raw JSON API response instead of rendering the page as expected. I did some digging tonight and I think what's going on is that the angular app changes the browser's URL to /employees but doesn't actually reload the page. The user can then interact with the application as normal and everything's fine until you refresh. At that point the request goes to the server, which routes /employees to the API instead of the angular app, and you get the JSON response.

I'm not 100% sure that's what's happening but based on looking at some of the HTTP responses and observing the browser, I think it's a solid lead.

I'm not sure how best to address this. One option would be for the angular app to not change the URL. Another would be to relocate the API endpoints under a /api prefix or something similar. I'm sure there are other options too.

I'm filing this here instead of mongodb-developer/mean-stack-example because it impacts our demo and we may want to employ an expedient workaround instead of figuring out a proper fix. I can file another issue over there if we think it's a good idea.