File tree 3 files changed +33
-3
lines changed
3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,37 @@ module.exports = class DevServer {
254
254
maxAge : 0
255
255
} ) )
256
256
257
- SsrExtension . getModule ( ) . extendApp ( { app } )
257
+ SsrExtension . getModule ( ) . extendApp ( {
258
+ app,
259
+
260
+ ssr : {
261
+ renderToString ( { req, res } , fn ) {
262
+ const context = {
263
+ url : req . url ,
264
+ req,
265
+ res
266
+ }
267
+
268
+ renderer . renderToString ( context , ( err , html ) => {
269
+ if ( err ) {
270
+ handleError ( err )
271
+ return
272
+ }
273
+ if ( cfg . __meta ) {
274
+ html = context . $getMetaHTML ( html )
275
+ }
276
+
277
+ fn ( err , html )
278
+ } )
279
+ } ,
280
+
281
+ settings : Object . assign (
282
+ { } ,
283
+ JSON . parse ( cfg . ssr . __templateOpts ) ,
284
+ { debug : true }
285
+ )
286
+ }
287
+ } )
258
288
259
289
app . get ( '*' , render )
260
290
} ,
Original file line number Diff line number Diff line change 11
11
* development server, but such updates are costly since the dev-server needs a reboot.
12
12
*/
13
13
14
- module . exports . extendApp = function ( { app } ) {
14
+ module . exports . extendApp = function ( { app, ssr } ) {
15
15
/*
16
16
Extend the parts of the express app that you
17
17
want to use with development server too.
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ if (ssr.settings.pwa) {
37
37
app . use ( '/' , serve ( '.' , true ) )
38
38
39
39
// we extend the custom common dev & prod parts here
40
- extension . extendApp ( { app } )
40
+ extension . extendApp ( { app, ssr } )
41
41
42
42
// this should be last get(), rendering with SSR
43
43
app . get ( '*' , ( req , res ) => {
You can’t perform that action at this time.
0 commit comments