Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 838 Bytes

README.md

File metadata and controls

38 lines (28 loc) · 838 Bytes

Rocket Demo Project

Write servers in Rust. Because Rust is awesome.

Installation and starting

Requirements:

  • cargo and rustup are installed.
  • postgres is installed
  • rustup install nightly
  • rustup default nightly
cargo install diesel_cli
pg_ctl start
# press CTRL-c
createdb rocket_demo
cargo run

Testing

curl localhost:8000/todos | jq
curl localhost:8000/todos/1 | jq
curl -XPOST localhost:8000/todos -d '{ "text": "Fight the borrow checker", "completed": true }' -H "Content-Type: application/json"
curl -XPATCH localhost:8000/todos/2 -d '{ "text": "Thank the compiler", "completed": true }' -H "Content-Type: application/json"

Other commands to play around with

diesel print-schema > src/schema.rs
diesel migration generate 'create_user_table'
diesel migration run