AndresSp
AndresSp

Reputation: 363

How could do some http requests just from the server side in Angular Universal

I'm implementing Angular Universal over an Angular project to hide some http requests, but in my research, I found that I can't hide those with the way provided by Angular. Did someone try to do the http request in the express engine an retrieve the data?

The target is a very large Angular 5 project (I know.. If I wanted to do the http requests from the server, I wouldn't use Angular but I didn't begin the project)

I applied the configuration recommended by Angular in this article: https://angular.io/guide/universal

I want to hide some requests from the client

Upvotes: 0

Views: 2589

Answers (2)

Craig
Craig

Reputation: 8294

You can make the HTTP calls server side and then send that state through with your page using the TransferHTTP library.

https://medium.com/@alireza.mirian/reusing-server-side-http-responses-in-front-end-when-using-ssr-in-angular-970d3efaea59

Upvotes: 0

David
David

Reputation: 34445

You cannot. Only initial page will be rendered using angular universal; once that page is loaded the client side angular application takes over and then you've got SPA navigation, with ajax calls to your API.

Upvotes: 2

Related Questions