angularstateserver-side-renderingtransferuniversal

Angular Universal API Calls through server


Learning about Angular Universal at the moment. I would like to have all API calls made by the server rather than the client. I have set up two interceptors, one for the server and the other for the client. Requests are intercepted for the initial load (When the app is first loaded or refreshed) by the server. However, after that, the client sends the API requests. Is that how Angular Universal is supposed to work? Does it just pre-render the first view or is there a way to get the interceptor to work after the initial load?

Thanks in advance


Solution

  • To answer my question, Angular Universal only pre-renders the app which means that requests are only intercepted on initial load or app refresh. In order to accomplish what I wanted (have every request go through the server), I used axios to make the http calls from the server.