Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Rocket is a Rust web framework for type-safe HTTP APIs with request guards, managed state, JSON and form handling.
92% 100%+8 ptsof test cases passed
Passed 24 of 24 test cases with the skill, and 22 of 24 without it.
This test ran on v1. v2 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
66 agent runs
1 forkA fork is a copy of this skill that someone made so they could edit it for their own use. The original doesn't change.
Rocket (crate rocket, current release 0.5.2 of 23 October 2026, Rust 1.89 or newer) is an async Rust web framework built on tokio. Routes are plain functions annotated with #[get], #[post] and so on; path, query, body and header inputs are typed parameters, and a request that does not parse is rejected before your code runs. Cross-cutting concerns are request guards (types implementing FromRequest), managed state (.manage(...) and &State<T>), and fairings (lifecycle hooks). Rocket has no built-in CORS or database layer: use the separate rocket_db_pools crate (0.2) for databases, and a CORS crate or your own fairing. Rocket 0.5.2 is a security-fix release (updated rustls, tokio, hyper, time), so upgrade from earlier 0.5.x.
cargo add rocket --features json (add secrets for private cookies, tls for HTTPS). Put #[macro_use] extern crate rocket; at the top of main.rs.#[launch] fn rocket() -> _ { rocket::build()... }. Mount routes with .mount("/api", routes![...]) and error handlers with .register("/", catchers![...]).#[serde(crate = "rocket::serde")] to structs, or add serde as your own dependency and drop the attribute.Option<T> gives 404 on None, Result<T, Status> gives the error status, (Status, Json<T>) sets the status, Json<T> serializes.#[get("/orders?<limit>")] with limit: Option<usize>; body: #[post("/orders", format = "json", data = "<input>")] with input: Json<NewOrder>. Add #[derive(FromForm)] for form and multi-value query structs.FromRequest for a guard type and add it as a handler parameter. Return Outcome::Error((Status::Unauthorized, ...)) (0.5 name; Failure was the 0.5 release-candidate name) to reject..manage(value) and &State<T>; wrap mutable data in Mutex/RwLock or atomics.Rocket.toml and ROCKET_* environment variables (ROCKET_PORT, ROCKET_ADDRESS, ROCKET_SECRET_KEY, ROCKET_PROFILE). The default address is 127.0.0.1:8000; in a container set ROCKET_ADDRESS=0.0.0.0. JSON bodies are limited to 1 MiB by default; raise with [default.limits] json = ....rocket::local::blocking::Client::tracked(rocket()) (or local::asynchronous::Client).rocket_db_pools with a driver feature (e.g. sqlx_sqlite, sqlx_postgres), #[derive(Database)] #[database("orders")] struct Db(sqlx::SqlitePool);, configure [default.databases.orders] url = "..." in Rocket.toml, .attach(Db::init()), and take Connection<Db> as a handler parameter.Request: "Build a small JSON API for orders where creating needs an API key."
# Cargo.toml
[dependencies]
rocket = { version = "0.5", features = ["json"] }
#[macro_use]
extern crate rocket;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Mutex;
use rocket::fairing::{Fairing, Info, Kind};
use rocket::http::{Header, Status};
Next to this one in the catalogue, plus popular skills in the same category.