Skip to content
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

inject the request object from express ? #58

Closed
dr1ss opened this issue Aug 16, 2017 · 4 comments
Closed

inject the request object from express ? #58

dr1ss opened this issue Aug 16, 2017 · 4 comments
Labels

Comments

@dr1ss
Copy link

dr1ss commented Aug 16, 2017

Hello guys,
I'm struggling to do something pretty simple : Grab the current hostname (domain name) and display it on a component. (I have multiple domain names pointing to the same application, so I need to get the hostname dynamically)
In a browser environment, I simply get it with document.location.hostname but since I'm using Universal, there is no such thing as document in a server environment.
So logically to achieve this, I will need to interact with nodejs request object and this is my question : Is there any way to inject the request and the response in Angular so I can get this kind of informations ?
I know it's possible with nguniversal/express-engine using Tokens (https://github.com/angular/universal/blob/master/modules/ng-express-engine/tokens.ts)
but I don't know if there is any way to achieve this with ngx-universal/express-engine

If anyone can help me with this please :)

@dr1ss
Copy link
Author

dr1ss commented Aug 16, 2017

Figured how to do this.. (ngx-universal/express-engine provides both request and response) sorry about that..

@dr1ss dr1ss closed this as completed Aug 16, 2017
@fulls1z3
Copy link
Owner

@dr1ss it's ok, and glad that express-engine helped you with it 👍

Meanwhile, don't hesitate to ask when you have further questions. I'll try to help everyone as time allows me.

@fulls1z3 fulls1z3 changed the title Inject the request object from express ? [question] inject the request object from express ? Aug 17, 2017
@dr1ss
Copy link
Author

dr1ss commented Aug 18, 2017

Thank you @fulls1z3 , still new to the angular world.. and there is so many things to figure out, especially with Universal.

@fulls1z3
Copy link
Owner

fulls1z3 commented Aug 21, 2017

@dr1ss don't worry all of us were new to this world some time ago, and if we talk about Angular there're really many things to learn, adapt and master on.

Don't hesitate to ask questions when you're stuck with something. I'll try to answer and help as time allows.

@fulls1z3 fulls1z3 changed the title [question] inject the request object from express ? inject the request object from express ? Sep 16, 2017
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