Closed valorloff closed 6 years ago
It looks to me like you want to share a DB connection between the serverRenderer middleware and the main node app?
Would passing the actual database connection into the middleware work for you, e.g.
// dev-server.js
app.use('/urlPath/:id',webpackHotServerMiddleware(compiler, {
serverRendererOptions: {
firebaseDatabase: firebaseDatabase
}
}));
Then in your server renderer you could do:
// server-renderer.js
module.exports = ({ firebaseDatabase }) => (req, res) => firebaseDatabase.getData(req.params.id).then((resp) => res.send(resp));
Yes! you guessed, thanks!
Hi! whether it is possible connect serverRendererOptions with fetched data?
like this: