Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example usage within express ? #7

Open
revskill10 opened this issue Apr 20, 2024 · 3 comments
Open

Example usage within express ? #7

revskill10 opened this issue Apr 20, 2024 · 3 comments
Assignees

Comments

@revskill10
Copy link

Could we embed the middleware within an express app ?

@lazarv
Copy link
Owner

lazarv commented Apr 24, 2024

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!

@revskill10
Copy link
Author

@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.

@lazarv lazarv self-assigned this May 23, 2024
@lazarv
Copy link
Owner

lazarv commented May 23, 2024

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!

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

No branches or pull requests

2 participants