fastboot-express-middleware icon indicating copy to clipboard operation
fastboot-express-middleware copied to clipboard

Returning HTML on Fastboot success prevents option of manipulating HTML afterFastboot

Open lukeclewlow opened this issue 8 years ago • 3 comments

My use case is that I want to cache the HTML that is generated from Fastboot. I use fastboot-express-middleware as middleware with fastboot-app-server. This has an afterFastboot hook, which is only accessible on an error because index.js line 51 res.send(html) just returns the HTML rather than calling next().

What I currently do is replace that line with next() and pass through the html on the response object.

Is this something that might be good to change, and how would it affect users not using fastboot-app-server?

Happy to make a pull request if you did think this was a valid change.

lukeclewlow avatar Aug 23 '17 07:08 lukeclewlow

I believe this would break existing apps. While I like the idea, if you want to cache your base page, wouldn't something like Ember-static-boot be more fitting?

I am open to calling next() as an opt-in rather than the default.

kratiahuja avatar Aug 23 '17 16:08 kratiahuja

Its slightly more complicated than I made out, and we don't want to serve a static site. Just cache the result of the fastboot rendered page so fastboot doesn't need to render it if nothing will have changed to make that necessary. The fastboot part is still very much a necessity for us.

Opting in would be great as I can see that it could be a breaking change otherwise.

lukeclewlow avatar Aug 23 '17 17:08 lukeclewlow

Would you mind opening a PR with this being an opt-in functionality? And from there we can see how we want to land this.

kratiahuja avatar Aug 24 '17 00:08 kratiahuja