Skip to content

Server side requires absolute url for http request? #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pjmagee opened this issue Apr 3, 2017 · 4 comments
Closed

Server side requires absolute url for http request? #146

pjmagee opened this issue Apr 3, 2017 · 4 comments
Labels

Comments

@pjmagee
Copy link

pjmagee commented Apr 3, 2017

This isn't particularly an issue with the template, but since I see you are working with the Nodejs and JavascriptServices side for the ASPNET prerendering, i figured i'd ask the question here. What is the best way to get a full current domain so i can prefix it to existing api calls that are relative?

@MarkPieszak
Copy link
Member

I was actually adding that into the project just earlier didn't get a chance to commit it just yet.
There are multiple ways though, but basically from either the boot-server, we can pass in the APP_BASE_HREF, or another Service we use for Http, there's many options like that. But we can pass params.origin into that and utilize it.

I'm on an iPad but I'll try to get the PR in so you can see what I mean!

To answer the question though yes we need them now. Previously we were "assuming" if you didn't provide a full URL we could use the originUrl from Node, but they didn't want to continue that habit.

HttpInterceptors are coming in 4.1, which will make this even easier since we'll be able to just prepend any http urls with what we want on the server.

Hope that makes sense!

@MarkPieszak MarkPieszak added the FAQ label Apr 4, 2017
@pjmagee
Copy link
Author

pjmagee commented Apr 4, 2017

That would be great! I'm currently in the process of migrating to Angular4 and we were heavily relying on the original template this repo provided. But I've been keeping an eye on this repo and making changes accordingly. 👍 Thanks for all the work thus far, it's been really helpful.

@MarkPieszak
Copy link
Member

Glad to help! I know it's been changing a lot, think it got more confusing than helpful after a bit, wanted to keep it at least a little simpler this time around.

It's already confusing enough sometimes right :) haha

@MarkPieszak
Copy link
Member

Done via #151

It's passed down into APP_BASE_HREF through the server (params.origin).

Check out the Rest demo (/users) for an example useage 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants