Skip to content

rbalicki2/rocket_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A todo list API with Rocket and Diesel

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages