Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Add middlewares to the config. (This can be useful if you want to pro… #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

denimamab
Copy link

…cess some treatment after the body-parser.)

@ljharb
Copy link
Collaborator

ljharb commented Aug 16, 2021

Can you elaborate about your use cases?

@denimamab
Copy link
Author

denimamab commented Aug 18, 2021

@ljharb Hello,

The use case is to implement a middleware that can read the body for each job and compare the version number with the hypernova-server version number. That assure to re-render the component if the cache version is not valid with the HS version and serve the urls for the right assets (js + css) in the meta field.

Monolithe: construct the jobs to process (if the job is already in a distributed cache [Eg. redis] we set a flag that the job is already in cache and here is the cache version => hypernova-server intercept these jobs and should process only the jobs that are not cache valid.

This answers the problem of cache invalidation strategy when deploying newer version of hypernova-service.

@nksfrank
Copy link

nksfrank commented Dec 14, 2021

you can access the express app by passing in a onServer callback to hypernova(config, onServer), that way you can add your middlewares after body-parser
https://github.com/airbnb/hypernova/blob/master/src/worker.js#L124

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants