An example demonstrating how to use Rust Actix web server to serve an Angular SPA.
- Build Angular SPA
$ cd angular-ui
$ ng build --prod --deploy-url /static/ --output-path dist/
- Run Rust Actix Server
$ cd ..
$ cd actix-backend
$ RUST_LOG=info cargo run
- Navigate in browser
Angular SPA entry point index.html
served by Rust server.
A simple web page served by Rust server.
Angular SPA static files (bundled JavaScript) served by Rust server.
All other GET routes are served by Angular.
-
If you navigate inside the Angular SPA: it is served directly by Angular.
-
If you navigate by URL, the Rust server first redirects all unknown routes to Angular SPA, and then it is further served by Angular.
Similar to all other GET routes, it is served by Angular SPA.