Rocket is one of the web development frameworks for the Rust programming language. It has a nice web site that comes with a nice tutorial, but for me, to undertand it I needed my own, stand-alone examples. On this page you'll find the list of examples. You can get the full source code of each one of them from Rust Maven GitHub repo or by following the links above the files.
-
Hello World! with Rocket -
text/plain
-
Hello World! in HTML -
RawHtml
,text/html
,headers
,get_one
. -
Hello World with Tera Templates -
rocket_dyn_templates
,Template
,context!
,render
,attach
,fairing
. -
Echo using HTTP POST - form handling -
POST
,Form
,Template
,header
,body
,ContentType::Form
,Status::UnprocessableEntity
,422
. -
Echo using HTTP GET =
GET
. -
Multi-counter using cookies -
CookieJar
,add
,get
. -
Multi counter using encrypted cookies -
add_private
,get_private
,secret_key
,Rocket.toml
,private_cookie
. -
Liniting issues with Rocket - Clippy
-
Logging in a Rocket-based web application -
log
,debug!
,info!
,warn!
,error!
. -
Access custom configuration in the routes -
rocket::Config
,figment
,extract_inner
. -
Get, set (add), delete cookies - pending cookies -
get
,add
,delete
,get_pending
,CookieJar
.