leptos/projects/nginx-mpmc
2024-08-10 20:01:41 -04:00
..
app-1 chore: upgrade dependencies (#2765) 2024-08-10 20:01:41 -04:00
app-2 chore: upgrade dependencies (#2765) 2024-08-10 20:01:41 -04:00
shared-server-1 chore: upgrade dependencies (#2765) 2024-08-10 20:01:41 -04:00
shared-server-2 chore: upgrade dependencies (#2765) 2024-08-10 20:01:41 -04:00
.gitignore docs: add projects directory with 4 projects (#2500) 2024-04-17 19:30:31 -04:00
kill.sh docs: add projects directory with 4 projects (#2500) 2024-04-17 19:30:31 -04:00
nginx.conf docs: add projects directory with 4 projects (#2500) 2024-04-17 19:30:31 -04:00
nginx_linux.conf docs: add projects directory with 4 projects (#2500) 2024-04-17 19:30:31 -04:00
README.md docs: add projects directory with 4 projects (#2500) 2024-04-17 19:30:31 -04:00
run.sh docs: add projects directory with 4 projects (#2500) 2024-04-17 19:30:31 -04:00
run_linux.sh docs: add projects directory with 4 projects (#2500) 2024-04-17 19:30:31 -04:00

Nginx Multiple Server Multiple Client Example

This example shows how multiple clients can communicate with multiple servers while being shared over a single domain i.e localhost:80 using nginx as a reverse proxy.

How to run this example

./run.sh 

Or

./run_linux.sh

This will boot up nginx via it's docker image mapped to port 80, and the four servers. App-1, App-2, Shared-Server-1, Shared-Server-2.
App-1, And App-2 are SSR rendering leptos servers.
If you go to localhost (you'll get App-1), and localhost/app2 (you'll get app2).
The two shared servers can be communicated with via actions and local resources, or resources (if using CSR).
`create_resource` Won't work as expected, when trying to communicate to different servers. It will instead try to run the server function on the server you are serving your server side rendered content from. This will cause errors if your server function relies on state that is not present.
When you are done with this example, run
./kill.sh

Casting ctrl-c multiple times won't close all the open programs.

Thoughts, Feedback, Criticism, Comments?

Send me any of the above, I'm @sjud on leptos discord. I'm always looking to improve and make these projects more helpful for the community. So please let me know how I can do that. Thanks!