docs: update documentation for universal - #7796
Conversation
| // * NOTE :: leave this as require() since this file is built Dynamically from webpack | ||
| const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle'); | ||
|
|
||
| const { provideModuleMap } = require('@nguniversal/module-map-ngfactory-loader'); |
There was a problem hiding this comment.
should include installation of this package in the installation section.
|
|
||
| // Import renderModuleFactory from @angular/platform-server. | ||
| var renderModuleFactory = require('@angular/platform-server').renderModuleFactory; | ||
| // ALl regular routes use the Universal engine |
| var renderModuleFactory = require('@angular/platform-server').renderModuleFactory; | ||
| // ALl regular routes use the Universal engine | ||
| app.get('*', (req, res) => { | ||
| res.render('index', { req }); |
There was a problem hiding this comment.
This assumes you're running the server.js in the same folder as your index.html yet below we describe using dist/browser, maybe sync those up?
There was a problem hiding this comment.
You don't need directory stuff here, we are just calling the engine here
There was a problem hiding this comment.
I meant the .render('index' dosen't that look for index.html in the directory it's being executed in?
There was a problem hiding this comment.
It has reference to it, since it's a lookup of the View, so having just index alone works since it knows which oneto find. You can be explicit and do res.render(join(DIST_FOLDER, 'browser', 'index.html'), { req }); but there's no need. ExpressEngines are almost always just a string like this one.
| }); | ||
| ``` | ||
|
|
||
| ## Step 5: Setup a webpack config to handle this Node server.ts file and serve your application! |
There was a problem hiding this comment.
Yeah I'll put that in there, good idea! Forgot the issue number 👍
|
You will want to remove the Aside from the cosmetic part, I'll let the Universal team review this PR. |
|
@MarkPieszak Can you provide at least some notes about the webpack warnings that arise? Perhaps mention the partial solution given by @gdi2290 at angular/angular#11580 (comment) E.g. It may warrant further discussion since these issues crop up with a lot of express dependencies, e.g. express itself, shrink-wrap, etc |
|
Thanks @hans, will make some updates & squash the commits. 👍 |
docs(universal): updates remove duplicate universal-starter link pick pocs: update with changes requested
…ular-cli into universal-readme
docs(universal): updates remove duplicate universal-starter link pick pocs: update with changes requested docs(universal): updates remove duplicate universal-starter link docs: update with changes requested update views dist_folder
…ular-cli into universal-readme
|
Closing for PR #7803 as history got out of control on this one. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Closes #7706
Closes #7248
Can close PR #7739
cc/ @hansl @vikerman @alxhub @Toxicable