---
title: "Discussion on \"Rust Development: Creating a REST API with Actix Web for Beginners\" | Hashnode"
description: "Discussion on \"Rust Development: Creating a REST API with Actix Web for Beginners\". TL;DR: Le code\nhttps://github.com/dirien/quick-bites/tree/main/rust-actix-web-rest-api\n \nIntroduction\nThis article walks through building a REST API in Rust using the Actix Web framework. The best way to learn something new? Try it yourself, make mis..."
url: "https://hashnode.com/posts/rust-development-creating-a-rest-api-with-actix-web-for-beginners/640c7acc0fc3ad7a73a9d4d5"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Rust Development: Creating a REST API with Actix Web for Beginners](https://blog.ediri.io/rust-development-creating-a-rest-api-with-actix-web-for-beginners?utm_source=hashnode&utm_medium=feed)

TL;DR: Le code https://github.com/dirien/quick-bites/tree/main/rust-actix-web-rest-api Introduction This article walks through building a REST API in Rust using the Actix Web framework. The best way to learn something new? Try it yourself, make mis...

Mar 11, 2023 · 10 min read · blog.ediri.io  
Updated Feb 1  
Read the article

-   [#rust](https://hashnode.com/tag/rust)
-   [#rest-api](https://hashnode.com/tag/rest-api)
-   [#developer](https://hashnode.com/tag/developer)
-   [#development](https://hashnode.com/tag/development)
-   [#apis](https://hashnode.com/tag/apis)

## Written by

[Engin Diri](https://hashnode.com/@ediri)

@ediri · Germany

  
[View profile](https://hashnode.com/@ediri)

Customer Experience Architect @ Pulumi

Cloud Native Pilgrim | Kubernetes Enthusiast | Serverless Believer | Customer Experience Architect @ Pulumi | (he/him) | CK{A,AD} |

## Responses 2

Markdown supported · ⌘↵ to post

[Ruge Wit](https://hashnode.com/@rugivit)

[Nov 25, 2023](https://hashnode.com/posts/rust-development-creating-a-rest-api-with-actix-web-for-beginners/640c7acc0fc3ad7a73a9d4d5/comment/6562704429658b9b067c2934)

Inside Database::update\_todo\_by\_id we create a new todo, but don't fill the field "created\_at", so that field will be null

[Raphael Carubbi](https://hashnode.com/@rcarubbi)

[Dec 6, 2023](https://hashnode.com/posts/rust-development-creating-a-rest-api-with-actix-web-for-beginners/640c7acc0fc3ad7a73a9d4d5/comment/6562704429658b9b067c2934#reply-656ff322d65dd4cd71f39c48)

you get by id first and then pass the current value to the new Todo instance:

```
pub fn update_todo_by_id(&self, id: &str, todo: Todo) -> Option<Todo> {
    let mut todos = self.todos.lock().unwrap();
    let updated_at = Utc::now();
    let index = todos.iter().position(|todo| todo.id == Some(id.to_string()))?;
    let todo = Todo {
        id: Some(id.to_string()),
        updated_at: Some(updated_at),
        created_at: todos[index].created_at,
        ..todo
    };
    todos[index] = todo.clone();
    Some(todo)
}
```

[Anna Smith](https://hashnode.com/@annasmith)

[Mar 31, 2023](https://hashnode.com/posts/rust-development-creating-a-rest-api-with-actix-web-for-beginners/640c7acc0fc3ad7a73a9d4d5/comment/64270a459bf2b1c9c2b0ecba)

Just wanted to say this worked perfectly, thank you!
