-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat(ssr): adds SSR support #237
Conversation
Hello 👋 @pavankjadda |
# Conflicts: # package-lock.json # package.json
a0ea87b
to
ed2fc11
Compare
I released one |
@@ -1,3 +1,14 @@ | |||
# 14.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class SsrCookieService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so basically instead of all conditional dependencies - you duplicate the service?
maybe not such a bad idea - to make it explicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. The other open I see is create a utility class/function that has common functionality and make both client/ssr cookie service use it. What do think about that?
My suggestion is we use this as it for now and think about optimization later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think that's a really good idea, instead of over-engineering, simple solution that just works!
@stevermeister I think we can merge this and release first SSR version. Based on user feed back, if needed we can change it. Thoughts? |
👍 |
Kudos, SonarCloud Quality Gate passed!
|
This PR creates new project
ngx-cookie-service-ssr
that adds support for SSR. So far 1 beta version and one rc version released with this PR changes and that can be seen here: https://www.npmjs.com/package/ngx-cookie-service-ssrHere is the summary of the approach
request
object, but since our cookie service depends ondocument
object we can't access themREQUEST
in providers. We can achieve this by modifyingserver.ts
fileREQUEST
object in cookie service, which helps us to get cookies on server side throughREQUEST
AppServerModule
Closes #225. Sample project can be found here https://github.com/pavankjadda/angular-ssr-docker