Closed vripoche closed 5 years ago
It is possible to do it in a plugin using onCreateServer
hook see https://github.com/smooth-code/smooth.js/blob/master/packages/smooth/src/server/expressApp.js#L19
For an example of plugin: https://github.com/smooth-code/smooth.js/tree/master/packages/smooth-plugin-css
You can create the plugin locally, see https://www.gatsbyjs.org/docs/creating-a-local-plugin/ (same for smooth). Plugins are not auto-discovered, so please specify it using require.resolve('./plugins/your-plugin')
.
It seems that the hook onCreateServer
is not trigger at all.
if I replace onCreateServer
by onBuild
, it is well triggered.
I tried to log string or/and to add non-valid JS inside callback function, nothing happened to output and on execution behavior.
@vripoche what is the version of smooth.js?
Hello @neoziro,
Yes indeed my version was v0.1.1-alpha.42
, I have updated, the hook is triggered.
Thank you.
Hi,
It could be really convenient to have the capability to configure response header for all pages (with a conf file), but also, if it possible, for particular ones (through WP page edition for example). The main purpose is to set cache-control header to adjust precisely the cache strategy from app.