Skip to content

Latest commit

 

History

History
47 lines (28 loc) · 1.16 KB

README.md

File metadata and controls

47 lines (28 loc) · 1.16 KB

rust crud api

following along: dev.to/francescoxx/rust-crud-rest-api-3n45

prerequesites

  • docker
  • rust

build

DB_URL='postgres://postgres:postgres@db:5432/postgres' cargo build --release    # build locally

docker compose -f docker-compose.yaml build app
docker compose -f docker-compose.yaml up -d                                     # build and run via docker

usage

docker compose -f docker-compose.yaml exec db psql -U postgres    # connect to db


curl localhost:8080/users
curl localhost:8080/users/

api

curl -XGET localhost:8080/users

curl -XGET localhost:8080/users/

jq --null-input '{"name": "foo", "email": "[email protected]"}' | curl -XPOST localhost:8080/users -d @-

jq --null-input '{"name": "max", "email": "[email protected]"}' | curl -XPUT localhost:8080/users/1 -d @-

curl -i -XDELETE localhost:8080/users/3

see also