This is an example of how to crate Rust full stack web application, using seed for frontend and actix-web for backend. We will utilize actix-web static files create to develop single binary embedding Seed frontend. We can then just run this binary to serve both frontend and API.
Follow Seed quickstart.
cargo make watch
cargo make serve
Based on https://github.com/seed-rs/seed/blob/master/examples/server_integration/server/src/main.rs.
Follow instructions on the actix-web static files documentation.
To see steps required for build have a look at build_and_run.sh
script. Reproduced here:
cd client
rm -rf dist
cargo make build_release
mkdir dist
cp index.html dist/
cp -r pkg dist/
cd ..
cd server
cargo build
cargo run
We will build client using command cargo make build_release
, then we will copy index.html
and pkg
directory into dist
directory that will be embedded into server binary.
Then we go to the server
and execute cargo build
.