Skip to content

Latest commit

 

History

History

rust

Rust CoffeeShop App

Rest API specs

Env

Create .env file

HOST=0.0.0.0
DATABASE_URL=postgres://postgres:P@ssw0rd@127.0.0.1/postgres
DAPR_URL=http://localhost:42573 #your Dapr product port on local, type <dapr list> to get it
DAPR_PRODUCT_APP=productapi

Dapr

dapr run \
    --app-id productapi \
    --app-port 5001 \
    --resources-path components \
    --config components/daprConfig.yaml \
    -- cargo run --bin product_api
dapr run \
    --app-id counterapi \
    --app-port 5002 \
    --resources-path components \
    --config components/daprConfig.yaml \
    -- cargo run --bin counter_api
dapr run \
    --app-id baristaapi \
    --app-port 5003 \
    --resources-path components \
    --config components/daprConfig.yaml \
    -- cargo run --bin barista_api
dapr run \
    --app-id kitchenapi \
    --app-port 5004 \
    --resources-path components \
    --config components/daprConfig.yaml \
    -- cargo run --bin kitchen_api

Database up

Before docker compose up, pls remember to run sudo rm -rf postgres-data

sea-orm-cli generate entity -l -s order -o crates/counter_entity/src
sea-orm-cli generate entity -l -s barista -o crates/barista_entity/src
sea-orm-cli generate entity -l -s kitchen -o crates/kitchen_entity/src

Ref projects

Ref articles