This is VERY SIMPLE web stack using leveraging
- M: Mongo DB as the database.
- A: Actix Web as the web server.
- Y: Yew as the front end framework.
- R: Rust, powering actix and yew.
This is largely inspired by M.E.A.N. websiting using NodeJS for the majority of development. Why be M.E.A.N. when you can be a M.A.Y.R. :)
Disclaimer: I'm new to Rust AND Web development. There are MANY ways this project can improve (ex: using an Agent instead of a Service in Yew, The handler functions to pass the requests to the Handler structs, etc.). This project was started to help me learn a bit about Rust, Mongo, and Docker and in that regard, I think it's been a success. That said, it's to a state where I think I'm happy to share it with anyone who stumbles on it on the internet.
- docker-compose up
- Build The Server:
docker build -t rust-server -f ./Dockerfile-server .
- Build the Client:
docker build -t rust-console -f ./Dockerfile-console .
- Launch Docker containers with mongo DB.
cargo run -p rust-server
NOTE: You'll need mongo DB running locally as well.
cargo build -p rust-console
wasm-pack build --target web --out-name wasm --out-dir static ./rust-console
miniserve ./rust-console/static/ --index index.html
First run the server using cargo run. TODO: DockerCompose
curl -d "{}" localhost:9080/coffee/list
curl -d '{"CoffeeStore": {"Name": "Rosolinis", "Description": "Coffee and Pastries", "AvgRating": 4.9}}' localhost:9080/coffee/create