#New to Rust Ecosystem, question about frameworks

25 messages · Page 1 of 1 (latest)

ember moat
#

they will be interopable, yes

#

because the interaction boundary is not a rust one

#

it's a network boundary, where all information is being shared through (usually) json

#

so any things that can speak json and http/ws will be able to talk

#

boundary as in »they communicate somehow, and that is not through rust«

#

they communicate through those web protocols

#

you can use react to talk to your backend, or vue, or elm, or literally anything else as long as it knows how to talk to your API/ws

#

we don't really have any frameworks which do both frontend and the server, no

#

mostly because they're different beasts

#

however, that doesn't mean you can't, say, use the exact same types in both the frontend and the backend. that's a very very common practice if you're using rust for both.

#

we don't have anything like that, no

#

as in, literally the exact same structs

#

make a third crate which has the types, and make both the frontend and the backend depend on that crate

#

all the shared types are in that third crate, ensuring nothing ever gets out of sync

#

a module wouldn't work

#

because then your client would have to depend on your server, or vice versa

#

so it'd have to be a crate

#

presumably your frontend and backend are different crates, so you just add this third one

#

that's not what you want

#

they're going to have to be different binaries

#

you compile the frontend crate to wasm

#

and the backend crate to your native os

#

doesn't have to be

#

a crate is anything with a Cargo.toml

rotund raven