Example usage within express ?
Could we embed the middleware within an express app ?
Hi @revskill10! It's not impossible, but the current implementation is not supporting it out of the box. The framework is meant to run as a standalone node.js app right now and it's using HatTip for the HTTP layer.
Keep in mind that this is only an experimental framework for testing and learning exercises about React Server Components and the challenges of creating a framework which supports the latest React SSR features. The framework might become more in the future, but it would need a refactor as newer versions of React introduced breaking changes and this framework is not compatible anymore with latest experimental React versions. But thanks for opening the issue!
@lazarv Thanks for the insights.
I'm trying to integrate react-server with nest.js framework.
It would be awesome if you could extract the react-server part there.
Hi @revskill10! I have some good news!
Here you can find some documentation to the new "middleware mode" of the framework. https://react-server.dev/guide/framework/middleware-mode
Also I created 2 small examples for Express.js and Nest.js at https://github.com/lazarv/react-server/tree/main/examples/express and https://github.com/lazarv/react-server/tree/main/examples/nestjs.
Please let me know if something is not working as expected. Right now it's a bit inconvenient how you can import the framework modules into the Nest.js project with the current TypeScript setup, but this is mostly a POC and can be enhanced later.
Please check out the documentation! I would really appreciate any feedback. Thanks!
Hey guys! @lazarv, what would a Socket.io implementation with react-server look like? I tried to follow the example of the integration with express, without success and I still lose the server routes.
Hey @ericdmachado! You tried to add a Socket.io implementation to the Express example at https://github.com/lazarv/react-server/tree/main/examples/express? Can you provide more details on your issue, or can you share a minimum reproduction of your issue? If something doesn't work regarding middleware mode, please open a new issue.