Serving frontend from Rust
We now know that we can serve our React application if we can serve a HTML file that can point to the bundle.js
file. Of course we can do this using a Rust server. To achieve this, we can create an ingress workspace with the following directory layout:
ingress
├── Cargo.toml
├── frontend
│ ├── esbuild.js
│ ├── package.json
│ ├── serve.json
│ ├── public
│ │ ├── bundle.js
│ │ ├── bundle.js.map
│ │ └── index.html
│ └── src
│ └── index.tsx
└── src
└── main.rs
Here we can see that the server in the ingress/src/main.rs
file is going...