Skip to content

@fastify/htmx@0.2.0

Compare
Choose a tag to compare
@galvez galvez released this 19 Feb 23:49
· 166 commits to dev since this release

This release contains a small addition allowingdecorateReply and decorateRequest to be exported from route modules, for purposes of preinitialisation of properties added to either object (and avoiding changing the V8 shape of them in runtime).

export const decorateRequest = ['data']

export function preHandler (req, _, done) {
  req.data = {}
  done()
}

export default () => (
  <>
    <h1>Page</h1>
  </>
)

Note that all of Fastify's route-level hooks can be already exported from route modules, as demonstrated above. This feature is provided by default in @fastify/vite, namely, in its default definition for the createRoute() hook.