File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import * as express from 'express';
6
6
import { readFileSync } from 'fs' ;
7
7
import { enableProdMode } from '@angular/core' ;
8
8
9
- const { AppServerModuleNgFactory} = require ( './dist-server/main.bundle' ) ;
9
+ const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require ( './dist-server/main.bundle' ) ;
10
10
11
11
enableProdMode ( ) ;
12
12
@@ -23,9 +23,17 @@ app.route('*').get((req, res) => {
23
23
24
24
renderModuleFactory ( AppServerModuleNgFactory , {
25
25
document : indexHtml ,
26
- url : req . url
26
+ url : req . url ,
27
+ extraProviders : [
28
+ LAZY_MODULE_MAP
29
+ ]
27
30
} )
28
- . then ( html => res . status ( 200 ) . send ( html ) )
31
+ . then ( html => {
32
+
33
+ res . set ( 'Cache-Control' , 'public, max-age=600, s-maxage=1200' ) ;
34
+
35
+ res . status ( 200 ) . send ( html ) ;
36
+ } )
29
37
. catch ( err => {
30
38
console . log ( err ) ;
31
39
res . sendStatus ( 500 ) ;
You can’t perform that action at this time.
0 commit comments