2023-02-08
2588
#rust
Bastian Gruber
17568
Feb 8, 2023 â‹… 9 min read

Building a REST API in Rust with warp

Bastian Gruber I'm a passionate software developer who mainly works with Rust to create services for the web. Next to that, I write for several tech magazines and publish articles on my own. Every now and then I get interviewed as well.

Recent posts:

Rust logo over black marble background.

Handling memory leaks in Rust

Learn how to manage memory leaks in Rust, avoid unsafe behavior, and use tools like weak references to ensure efficient programs.

Ukeje Goodness
Nov 20, 2024 â‹… 4 min read
Robot pretending to be a person.

Using curl-impersonate in Node.js to avoid blocks

Bypass anti-bot measures in Node.js with curl-impersonate. Learn how it mimics browsers to overcome bot detection for web scraping.

Antonello Zanini
Nov 20, 2024 â‹… 13 min read
Solving Eventual Consistency In Frontend

Solving eventual consistency in frontend

Handle frontend data discrepancies with eventual consistency using WebSockets, Docker Compose, and practical code examples.

Kayode Adeniyi
Nov 19, 2024 â‹… 6 min read
How To Use Lazy Initialization Pattern With Rust 1.80

How to use the lazy initialization pattern with Rust 1.80

Efficient initializing is crucial to smooth-running websites. One way to optimize that process is through lazy initialization in Rust 1.80.

Yashodhan Joshi
Nov 18, 2024 â‹… 5 min read
View all posts

5 Replies to "Building a REST API in Rust with warp"

  1. Thanks, I was stuck but your tutorial helped me. I’m noob to rust so I would love more tutorials 🙂

  2. Thanks for the tut. One remark though:
    “Due to the nature of Rust’s ownership model, you can’t simply read and return the underlying list of groceries.”
    That’s not true, the Deref trait on Mutex allows us to do this:

    Ok(warp::reply::json(&*store.grocery_list.read()));

    Cheers 🙂

  3. Thanks for the tutorial.

    Maybe I am missing something, but it seems to me, your curl delete example is missing the id. In fact I am missing where the id path section is defined at all for get (on a single item) and put.

  4. sorry noob here, how can I solve this ?:

    error: cannot find derive macro `Deserialize` in this scope
    –> src/serve.rs:69:17
    |
    69 | #[derive(Debug, Deserialize, Serialize, Clone)]
    | ^^^^^^^^^^^

    Thanks a lot !

Leave a Reply