Rocket

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 9750ae67dd929c4ee09d198338a719e662eae4c6
parent ca5623c6414bdfa953a4499c0a17f3419de8fc38
Author: John Downey <jdowney@gmail.com>
Date:   Sat,  8 Dec 2018 17:07:50 -0600

Update pastebin guide for 0.4.

Diffstat:
Msite/guide/10-pastebin.md | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/site/guide/10-pastebin.md b/site/guide/10-pastebin.md @@ -44,7 +44,6 @@ Then add the usual Rocket dependencies to the `Cargo.toml` file: ```toml [dependencies] rocket = "0.4.0" -rocket_codegen = "0.4.0" ``` And finally, create a skeleton Rocket application to work off of in @@ -136,7 +135,7 @@ use std::borrow::Cow; use rand::{self, Rng}; /// Table to retrieve base62 values from. -const BASE62: &'static [u8] = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +const BASE62: &[u8] = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /// A _probably_ unique paste ID. pub struct PasteID<'a>(Cow<'a, str>); @@ -179,7 +178,7 @@ Finally, add a dependency for the `rand` crate to the `Cargo.toml` file: ```toml [dependencies] # existing Rocket dependencies... -rand = "0.3" +rand = "0.6" ``` Then, ensure that your application builds with the new code: @@ -251,7 +250,7 @@ fn upload(paste: Data) -> io::Result<String> { } ``` -Make sure that the route is mounted at the root path: +Ensure that the route is mounted at the root path: ```rust fn main() { @@ -304,6 +303,14 @@ fn retrieve(id: &RawStr) -> Option<File> { } ``` +Make sure that the route is mounted at the root path: + +```rust +fn main() { + rocket::ignite().mount("/", routes![index, upload, retrieve]).launch(); +} +``` + Unfortunately, there's a problem with this code. Can you spot the issue? The [`RawStr`](@api/rocket/http/struct.RawStr.html) type should tip you off!