Build A Rust Backend (Really FAST Web Services with Actix Web)

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ก.ค. 2024
  • An overview of one of the fastest web frameworks available today - Actix Web. To get a feel for the developer experience it provides, we walk through building a task management REST service.
    00:00 Overview
    00:53 Project Creation / Directory Structure
    01:38 Cargo.toml
    02:40 Main.rs Iteration 1
    05:36 API Module Iteration 1
    06:45 Responders
    07:30 Extractors
    09:52 Integrating with DynamoDB
    11:23 Injecting DDB Client Into Handler Functions
    14:07 Model Module
    17:32 API Module Iteration 2
    18:41 Error Handling
    21:34 API Module Iteration 2 Cont.
    29:36 Main.rs Iteration 2
    30:00 Testing
    31:11 Conclusion & Review
    Stuff I use to make these videos - I absolutely love all of these products. Using these links is an easy way and free way to support the channel, thank you so much if you do so!!!
    Camera: Canon EOS R5 amzn.to/3CCrxzl
    Monitor: Dell U4914DW 49in amzn.to/3MJV1jx
    Lens: Sigma 24mm f/1.4 DG HSM Art for Canon EF amzn.to/3hZ10mz
    SSD for Video Editing: VectoTech Rapid 8TB amzn.to/3hXz9TM
    Microphone: Rode NT1-A amzn.to/3vWM4gL
    Microphone Interface: Focusrite Clarett+ 2Pre amzn.to/3J5dy7S
    Tripod: JOBY GorillaPod 5K amzn.to/3JaPxMA
    Keyboard: Redragon Mechanical Gaming Keyboard amzn.to/3I1A7ZD
    Mouse: Razer DeathAdder amzn.to/3J9fYCf
    Computer: 2021 Macbook Pro amzn.to/3J7FXtW
    Caffeine: High Brew Cold Brew Coffee amzn.to/3hXyx0q
    More Caffeine: Monster Energy Juice, Pipeline Punch amzn.to/3Czmfox
    The full code for this project can be found here: github.com/Me163/youtube/tree...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 165

  • @edgeeffect
    @edgeeffect ปีที่แล้ว +66

    My main interest in Rust, so far, has been for doing bare-metal embedded development. So it's quite fascinating to see you doing web-backend stuff in Rust (that's my day-job).
    The idea of using one language for low-level, high-level and everything-in-between-level is quite refreshing in this day and age where I jump from PHP to Python to C and fiddle-faddle with some other stuff too (although I'm still stuck with Kotlin for now if I'm doing anything Android).
    I am very taken with the idea of *"One language to rule them all... and in the crab shell bind them".*

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +10

      Yeah I do think Rust is under appreciated for webapp development and other things conventional wisdom says you should use a "higher level" language for. It seems like it's been unfairly pigeonholed as a "systems language" in that sense. Love the LOTR adaptation haha

    • @edgeeffect
      @edgeeffect ปีที่แล้ว +1

      @@codetothemoon zero cost abstractions make it all worthwhile.

    • @RogueTravel
      @RogueTravel ปีที่แล้ว

      I am an Android developer as well. If you’re willing to endure some pain, try using the Java native interface along with Rust foreign function interfaces. It’s quite fun, way more exciting than building a CRUD backend with a web app!

  • @user-xu3so2ug1f
    @user-xu3so2ug1f ปีที่แล้ว +4

    im really happy that i found your channel, finally some good rust content :)

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +1

      fantastic, glad you got something out of it! happy to have you here!

  • @JarofRichandHardStar
    @JarofRichandHardStar 7 หลายเดือนก่อน +2

    I totally enjoyed watching this video. Learning by doing at its best! Thank you so much!

  • @briankuehn5379
    @briankuehn5379 ปีที่แล้ว +3

    I really appreciate your videos! Thanks for the time and effort you put into them!
    For us that are visual and helicopter learners (meaning we need visual reenforcement between topics and a wide scope of view down to details) I could use a bit more space in-between topics with maybe a bullet-list of where we are going. The speed of this particular video is perfect language-wise, but you have a tendency to speed up in some of your other videos. You have a good resonant voice, a good dialect, and speak clearly - which is awesome! Keep up the great work!!

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +2

      Thanks so much for the kind words and for the feedback!! I think spacing out the topics and maybe using a bullet list as the "roadmap" for the video is a fantastic idea - I'll likely incorporate something like this in future videos!

  • @jemduff
    @jemduff ปีที่แล้ว +1

    Best rust content out there at the moment! Keep up the great work.

  • @The_SSS
    @The_SSS 2 ปีที่แล้ว +1

    This is amazing, just what I needed. Thank you so much!

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +1

      thanks, so happy you found it valuable!

  • @JosephDalrymple
    @JosephDalrymple 2 ปีที่แล้ว +14

    Having never really coded much in Rust before, trying to introduce Postgres, to make this a little more portable and less cloud-dependent, has proven to be quite the exercise! Definitely went down the rabbit hole on this one haha.
    I really like how you laid everything out with this project. This all seems right. Most demos, tutorials, and other things out there are just kind of the bare-minimum code necessary to get something to compile and run. I've been trying to get some good insight into how Rust devs actually structure their projects, split things out, et cetera. Hoping I can adapt this to leverage Postgres! (Or maybe even Diesel, somehow)

    • @JosephDalrymple
      @JosephDalrymple 2 ปีที่แล้ว +4

      Also, the editing seemed pretty spot on! I had to do lots of pausing and whatnot, though, so the only suggestion would be to maybe keep a few more frames in between jumping around, just so that those who need to can pause the video and don't have to back track much.

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +5

      Thanks Joseph! Would be awesome if you could share your experience integrating with Postgres/Diesel - I believe I'm going to make a video about this in a few weeks.
      Re: pacing, thanks so much for the feedback! I'll make an effort to pause a bit more in future videos!

  • @sebajean-baptiste6240
    @sebajean-baptiste6240 ปีที่แล้ว

    Jee Dude,
    I watch you code in rust and I am amazed at your skills and the language.
    I love rust and for the first time, I wish there was a magic pill that could get me there fast. I am a Senior Java guy and do that all day for now. But man! What an awesome language. Keep these examples coming.
    Please!

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      Thanks so much for the kind words Seba! I actually have a similar background - was a die-hard Java fan up until a few years ago. Was really into Java Swing back in the early 2000s. Rust can seem intimidating, but once you internalize the tricky parts it's all downhill from there. Check out the "Rust Demystified" video if you haven't already!

  • @zorbanoodle356
    @zorbanoodle356 ปีที่แล้ว +1

    thanks for the amazing video!, im currently starting out with rust as my first "proper" attempt at learning a language. i heard programming a website is really good for learning so im going to try and build an entire site with just rust and some mysql as apparently you can code the front and back end in rust! thanks again

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      Nice Zorba! I've actually never heard of anyone learning Rust as their first programming language. There are quite a few folks that might try to talk you out of it, but I think you'll be fine! It is indeed very versatile.

  • @yankee-in-london
    @yankee-in-london 2 ปีที่แล้ว +14

    Thanks for this video. clear, concise, and good pacing (for me at least). I love Actix's perf characteristics but being new to Rust it feels a bit more intimidating than some of the other frameworks but I think you've talked me into it. Now I just need to get my head around when to use the Actix web framework versus the actor framework ... and I see now they have a broker too?

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +2

      Glad you found it valuable! I actually haven't delved into the actix actor framework yet - apparently (at least according to actix.rs) Actix web doesn't use the actix actor framework under the hood anymore. Seems like it has been at least partially replaced by language features...

  • @user-ex8vj4qe7n
    @user-ex8vj4qe7n ปีที่แล้ว +1

    Your video is awesome!!!!!
    Thank you so much!

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      Thank you, glad you found it valuable!

  • @user-bu3hz5be5w
    @user-bu3hz5be5w ปีที่แล้ว +1

    Super helpful video, thanks!

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +1

      nice, happy you got something out of it!

  • @gamer-gw9iy
    @gamer-gw9iy 2 ปีที่แล้ว +1

    Great video, thank you 😁👍

  • @commiekaza
    @commiekaza 2 ปีที่แล้ว +1

    very cool, thanks for the rundown, stay rusty

  • @hackermen69
    @hackermen69 2 ปีที่แล้ว +44

    Hello, You're producing really good content. i have watched other rust related video, Keep it up. One suggestion, consider shrinking down your video little bit, currently it feels bit overwhelming. Like almost 1/4th of the screen so reading code becomes bit difficult.

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +17

      Thanks for the kind words! and thanks for letting me know about the video being too large, that's just the sort of feedback I'm looking for! Will make it smaller in the next one.

    • @pedrosliuzas3206
      @pedrosliuzas3206 ปีที่แล้ว

      @@codetothemoon 😂🎉 🎉e 1:08 😢😅😮😮😢

  • @jessereyes-cortes1194
    @jessereyes-cortes1194 2 ปีที่แล้ว +1

    Well looks like you earned yourself a subscriber!

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +1

      Thanks Jesse, very happy to have you onboard!

  • @mascotto
    @mascotto ปีที่แล้ว +1

    Congrats!!

  • @PeterNirschl
    @PeterNirschl 5 หลายเดือนก่อน +1

    very helpful, thanks!

    • @codetothemoon
      @codetothemoon  5 หลายเดือนก่อน

      thank you so so so much for your support! 😎 realy happy you got something out of the video!

  • @christophjasinski4804
    @christophjasinski4804 24 วันที่ผ่านมา

    Young Val Kilmer teaching me Rust, nice.

  • @racastellanosm
    @racastellanosm ปีที่แล้ว +5

    I'm a new developer in RUST and this was an awesome tutorial. I came from PHP and Typescript and I was looking for a new language to build fast REST API Backends. Thanks for this tutorial.
    One question: Between Actix and Rocket do you se any big difference? Do you recommend to use Actix-Web? Thanks again for this quality material.

  • @profiluefter
    @profiluefter ปีที่แล้ว +2

    Very interesting and good paced video! One small thing I'd have found interesting is starting the program a few times inbetween and look at the current progress. Also the compiler error at 13:15 would have been interesting. But overall very high quality content! Can't believe you don't have more subscribers

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +1

      Thanks Fabian! This is fantastic feedback. Next time I do something like this i'll try to run it after each sort of "milestone" so it's easier to see the progression

  • @jp2kdev
    @jp2kdev 2 ปีที่แล้ว +1

    Great, thank you.

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      You're very welcome, thanks for watching!

  • @marianivanov6431
    @marianivanov6431 2 ปีที่แล้ว +1

    i like your style this fast 2x when write code good idea

  • @heldim92
    @heldim92 ปีที่แล้ว

    Hi! Awesome video. Which language, out of the following three, would you say that makes web dev easier/faster without sacrificing speed? Rust, Go or Elixir?

  • @andythedishwasher1117
    @andythedishwasher1117 ปีที่แล้ว +1

    As a basic proof of concept for a larger idea I've been sitting on, I'm trying to find a backend framework that will efficiently receive input data with specifications for a Vue component (template element types, selected style properties, a specified set of variables, and a limited set of methods to perform on these variables) and respond with a properly formatted text file that can be mounted to a code element on the front end. Do you think Actix is a good choice for a gizmo of that nature?

  • @teach_ex1
    @teach_ex1 2 ปีที่แล้ว +3

    Thanks for this awesome tutorial, loved the way you explain rust🙌. do you have any plans on making a tutorial for actix or so. since there are fewer or not useful videos on this framework. Thanks.

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +2

      Thanks, glad you found it valuable! Do you mean actix as in the actor framework?

    • @teach_ex1
      @teach_ex1 2 ปีที่แล้ว

      @@codetothemoon Tutorial for actix v4, i don't know about actix in actor framework but it have been 2 months i have stated learning rust and now i love to code in rust and use actix with PostgreSQL for web backend.

  • @neilclay5835
    @neilclay5835 ปีที่แล้ว +1

    I like the style of your videos - they're to the point and concise. Would it be possible to turn off the VSCode pop-ups whilst you're doing them though? There's a lot of time where I'm slightly behind you in comprehending what you just did, but the pop-up is covering the code now.

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +1

      Thanks Neil! and great feedback, I generally intend to turn off the hints / autocomplete before recording a video, but there are several videos where I neglected to do so, including this one T_T

  • @martinbecker1069
    @martinbecker1069 ปีที่แล้ว +2

    Just an FYI, methods are functions defined for a struct (or an enum or trait object).
    So no need to self correct there ;)

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      Got it thanks Martin! I think in the moment I got scared that I had borrowed a term from a non-Rust language, glad to hear that wasn't the case....

    • @martinbecker1069
      @martinbecker1069 ปีที่แล้ว +1

      @@codetothemoon YW, I like your videos so being able to help make them better is awesome, terminology can be weird and inconsistent :p. You have functions, associated functions, anonymous functions & methods (I think that's it?).

  • @MentalMarathon_
    @MentalMarathon_ 3 หลายเดือนก่อน

    Thank you for this explanation! Would you ever consider making your own blockchain ?

  • @andydataguy
    @andydataguy 2 ปีที่แล้ว +1

    Great videos! Didn't see the dynamo setup video on your channel. Perhaps a "suggested video" card could be helpful for people to reference your previous videos easier

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      thank you and great idea! did a video on dynamoDB here th-cam.com/video/_TQ3UTyKdJ8/w-d-xo.html more of an overview of what its capable of than a tutorial though, for the latter you might try the aws docs here docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html

  • @morkhoudia9
    @morkhoudia9 2 ปีที่แล้ว +1

    Hello, thanks you for this tutorial. It will be interesting for one to many use case or similar to see rust framework powerful ?!

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      thanks for watching, glad you found it valuable!

  • @amankansal5529
    @amankansal5529 วันที่ผ่านมา +1

    Do you think is it good for web development.
    Like i have a strong foundation in rust.
    But I don't know should i do web development in rust or not ?
    Or should i stick to typescript for web development?

  • @eddysanoli
    @eddysanoli 2 ปีที่แล้ว +1

    Hey! What are the extensions you are using for this video? For a moment I started adding a lot of additional keywords to the script, until I realized that those were generated by your VSCode extensions. But they seem pretty cool!

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      I use rust-analyzer. it's the second most popular extension when you search for "Rust" in VSCode's extension marketplace. Heard somewhere it's better than the first one, but I haven't personally done a rigorous comparison.

    • @eddysanoli
      @eddysanoli 2 ปีที่แล้ว

      @@codetothemoon Perfect. Thank you!

  • @PaulSebastianM
    @PaulSebastianM ปีที่แล้ว +1

    15:50 for the Task struct, why didn't you use str instead of all those String's?

  • @samirm
    @samirm ปีที่แล้ว

    are there any IDEs with proper syntax highlighting and intelligent code inspection/suggestions for rust? looking for basic things like automatically importing the right object when trying to use it in the file, or suggestions for overriding methods that are missing, or intelligent suggestions for idiomatic uses. i'm currently trying to IntelliJ + clippy but it's really lacking compared to something like Java

  • @pedrolemos3030
    @pedrolemos3030 2 ปีที่แล้ว +3

    Hi! Great video, just a question. How does one learn all these stuff? Not only related to rust (like the libraries, and such), but web applications in general? I find it extremely overwhelming considering the amount of stuff related. If you had any advice, that would be awesome.

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      thanks Pedro! I wish I had a good recommendation for a one-stop resource for learning about REST services and webapps. My advice would be to take a course on Next.js (well established framework) or SvelteKit (the up and coming framework that appears to be favored over Next by many people) - those should cover all aspects of webapp development as they encompass both the frontend and the backend.

  • @AfroHammerMedia
    @AfroHammerMedia 2 ปีที่แล้ว +1

    Hi! What would you personally recommend as the best Rust project for a beginner to start working on?
    I've been dabbling with Ruat since getting into Wasm a while ago but want to dive in and properly learn. Not sure where to start though...

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +3

      Great question - I actually think a simple webapp is a good place to start - either the frontend, backend, or both. Or if you're into making games, it seems like there are a few Rust game frameworks that have garnered a substantial following. You mentioned WASM - some of them support browsers as a build target. I haven't tried any of them yet, but it seems like a fun place to start. Check out the TH-camr "Tantan" if that side of things sounds interesting!
      In terms of approach - I generally dive headfirst into the project, get stuck, read the Rust Book and watch "Let's Get Rusty" videos to get myself unstuck, then repeat over and over...

  • @thatonesnowboarde
    @thatonesnowboarde ปีที่แล้ว +1

    This is good stuff, its a bit confusing coming from a Model,view,controller framework do you have any other tid-bits on how to get started with Actix Web and incorporating front end elements like html files or do you suggest using this for the API and other methods for working with views? I have been using codeigniter but I think I am about to move away from it, because they broke their codebase with the new version, so rather than learn relearn the changes in v4 I was considering to switch to something else. Completely new to Rust though.

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      Hi thatonesnowboarde - maybe check out the "Build A Rust Frontend" video! This particular video is about the backend - MVC is more of a frontend abstraction. Then There is another video called "Full Stack Rust" that ties everything together.

  • @theninjascientist689
    @theninjascientist689 ปีที่แล้ว +2

    Followed the tutorial, made an AWS account but now I'm not sure what to set the primary and sort keys in the table as. Anything I seem to try just results in "One or more parameter values were invalid: Missing the key" and a TaskCreationFaliure.

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +1

      Just took a look - as written my code expects there to be a partition key called "pK" and a sort key called "sK". The contents of the partition key is an arbitrary "user" uuid, and the sort key is an arbitrary "task" uuid.

  • @jakejscott
    @jakejscott 2 ปีที่แล้ว +3

    You could pass task using a pointer so that the task can be borrowed, then you wouldn't have to copy the task_identifier

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      thanks for the pointer (pun intended?) there were a few places where I was trying to pass a borrowed value but couldn't get it to work, I'll revisit this one!

  • @Kiaulen
    @Kiaulen ปีที่แล้ว +2

    What's interesting to me is actually how slow a lot of those requests ended up being. I assume it's probably network latency to DDB, but 221ms to do a single lookup on a tiny table and return it as JSON seems like a lot.
    For reference, a brand new Ruby on Rails app hitting a local mysql takes about 50ms for me, and Ruby/Rails is considered bloated and slow by many.

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +3

      You're absolutely right - I actually didn't notice the latency until you pointed it out! 200+ms does seem really slow. I'll have to dig in and find out where the bottleneck is - my guess is that it's not the Actix framework though.

    • @lucaszecat
      @lucaszecat ปีที่แล้ว

      @@codetothemoon Any luck figuring out the bottleneck source ?

    • @thesupermable
      @thesupermable ปีที่แล้ว

      @@lucaszecat i think its always the io to aws sdk. its been always to io like to database, or sdk or another services

  • @wuxxy
    @wuxxy ปีที่แล้ว

    9:41 what is that phenomonen called because I've made that same mistake so many times and it fascinates me how our brain even though it knows what we meant to write we still write what we were saying with our mouth instead

  • @AlvaroAlfaroSantiesteban
    @AlvaroAlfaroSantiesteban 2 ปีที่แล้ว +1

    Hello! Love your content. Do you plan on creating a video tutorial to create a web app with Actix and Yew?

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +2

      Thanks Alvaro! I do plan on creating just such a video. Will also likely be creating ones for productionizing such an app, including things like auth, CI/CD, deployment to AWS, etc.

    • @AlvaroAlfaroSantiesteban
      @AlvaroAlfaroSantiesteban 2 ปีที่แล้ว +1

      @@codetothemoon If you can throw in some Diesel or other ORM that would be great as well :)

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      @@AlvaroAlfaroSantiesteban been meaning to check out Diesel, will see what we can do!

  • @arshy3259
    @arshy3259 ปีที่แล้ว

    Does anyone know how to connect this application with local dynamodb (docker)? What kind of environment variables are needed?

  • @Pilosofia
    @Pilosofia 2 ปีที่แล้ว +2

    in the newest version of cargo we can use " cargo add " to add dependencies.

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +2

      I haven't tried this yet, should save a ton of time!

    • @Pilosofia
      @Pilosofia 2 ปีที่แล้ว +1

      @@codetothemoon I'm a new rustocean, I used to use nodes packages managment and figure out that by coincidence

  • @barefeg
    @barefeg ปีที่แล้ว

    Any ideas how to implement onion architecture and unit of work in Rust?

  • @joeesser9933
    @joeesser9933 2 ปีที่แล้ว +1

    can you explain what you typed in postman also where to get an user id and the blender file or is it not necessary

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      re: postman, we first create a task by doing POST to the create task API, which accepts a JSON body where we specify various attributes of the task. This returns the task id of the newly created task, which we can pass to the other task APIs via a URL path parameter. re: user id and blender file, these are just dummy values that we store in the database, as written in this video they don't have any functional effect. So you can just use any random values for those.

  • @jcolindres001
    @jcolindres001 ปีที่แล้ว +1

    Hello,
    Excellent video.
    What is your advise about Tokio framework and diesel; can they be used in a backend API together with actix-web?

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      thanks, glad you got something out of it! re: Tokio - I think most developers won't have to interact with it directly (it's likely a transitive dependency of the crates you might use). Re: Diesel, it should work great with actix-web!

  • @user-ge2vc3rl1n
    @user-ge2vc3rl1n ปีที่แล้ว +1

    I personally would like to see you flesh out the repository code even if you think it's not worth it. Also don't feel insecure about your code!! Not sure why you didn't show it but I appreciate your videos even if you think the code is "hairy" here and there.

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +1

      I would have loved to explain it but was worried the lengthy explanation would dilute the "value per watch second" folks get out of the video, especially for those that don't plan to use DDB.

  • @recarsion
    @recarsion ปีที่แล้ว

    Hey, great tutorial, but I've run into a problem with the dependency injection part, I hope someone here can help me with that.
    So what I have is a setup similar to this, except instead of dynamodb I have a connection to a postgres database via Diesel. I'm only working with a single table called "Student" for now with id, name, email and dob.I use this connection to construct a PostgresStudentRepository struct that is responsible for all of my data access operations (get, get_all, insert etc)
    So far so good, but I'd like to abstract this away so that my api doesn't depend on a specific implementation so that I can swap it out easily if I want, or use a mock implementation or maybe some in-memory db for testing. For this I have created a StudentRepository trait that my PostgresStudentRepository implements. (I know this is still not the most optimal solution as I could generalize the Repository pattern even more to be able to use it for other tables as well, but this is what I'd like to get working for now.) And in my API I accept Data instead of Data.
    However when I try to call my endpoints, I get an error saying "Failed to extract `Data`.
    I have found this SO question with a very similar problem: stackoverflow.com/questions/65645622/how-do-i-pass-a-trait-as-application-data-to-actix-web
    Here they suggest to wrap my struct in an Arc before injecting it, so like Data::from(Arc::new(blahblah)), I've tried this but I still get the same error. I've also tried using static dispatch to get the same effect but it didn't compile, said it couldn't infer the type, which is why I'm using dyn in the first place.
    I suspect there is something I'm missing, so in general how should I go about injecting traits with App::app_data? Thanks.

  • @sercanyildirimtugcann
    @sercanyildirimtugcann ปีที่แล้ว +1

    Hi, Simple question. Can we create e-commerce, airbnb like websites using Rust? How can we handle its front end part without touching react or vue at all? I think we need more clone projects from stretch! Thank you!

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      yep there's nothing preventing you from doing that 100% in Rust! On the frontend you can use something like Yew or Leptos (the latter feels a bit more like the future but the former is more mature). Though you could argue that if the project is business critical something like react/vue/svelte would be a "safer" choice

  • @lukasz443
    @lukasz443 2 หลายเดือนก่อน

    Bro, your camera window is definitely too small😂 tbh, make it smaller who cares about your appearance rather than the code. Btw great material, appreciate your work!

  • @sasakanjuh7660
    @sasakanjuh7660 ปีที่แล้ว +1

    Damn, stopping/going back a couple of time I managed to catch like 10 ads for 30 mins video.. Even when one tries to use yt for some useful/productive purpose, it's still such a terrible platform..
    Great video though, as always! :)

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      Yikes that’s so frustrating! TH-cam Premium is amazing… had it for the past 4 years or so, tried living without it for a week or so at one point and quickly realized it’s the most important subscription I have 😎

    • @sasakanjuh7660
      @sasakanjuh7660 ปีที่แล้ว

      @@codetothemoon Damn, somehow I didn't even consider it.. I heard it's a thing quite some time ago, but it just slipped through the cracks, seems like no-brainer at this point I guess :D
      Keep up the awesome work! :)

  • @theentertainment7239
    @theentertainment7239 ปีที่แล้ว +1

    Thank you for tNice tutorials video! I just got soft softs today, and even with the guidebook, I was lost. TNice tutorials video taught even better than

  • @funnynews341
    @funnynews341 2 ปีที่แล้ว +1

    Could i use this videos tut in productions for backend api webserver?

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +1

      it's the start of something that could be used in production, i think in most cases you'd also want to have some kind of authorization/authentication as well. let me know if you'd find a video on that valuable!

  • @HyperFocusMarshmallow
    @HyperFocusMarshmallow ปีที่แล้ว +1

    Great video.
    A quick thought: (hot take, don’t take too seriously, and I know the video is old.)
    Writing out all the dependencies early on is typically not how I develop. I usually start fresh and then I add dependencies one at a time as I need them by looking at the relevant docs. Until I work with them enough to know them by heart. My thought is that maybe it would be clearer to present it that way.
    But maybe it isn’t.
    Do you usually program like this or is it for presentation purposes?

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      thank you - and this is great feedback! I did it this way just for presentation purposes - to your point, when I'm actually developing I add them as needed. After thinking about it for a minute, I think you're right - if I add dependencies as I need them, it would probably make it easier for the viewer to mentally connect the implementation with the specific dependency required for that logic.

  • @glennmiller394
    @glennmiller394 ปีที่แล้ว

    What should aws_config::load_from_env() be loading? I've placed nothing in the environment for it.

    • @jacksonbrim7359
      @jacksonbrim7359 ปีที่แล้ว +1

      it loads from your aws configuration files. If you download the aws cli, you can use it to configure your keys and profiles.

  • @eyo4821
    @eyo4821 10 หลายเดือนก่อน

    Great tutorial! Unfortunately I am quite stuck at the last step with the testing. I have ensured my code is just like yours, but when I submit the post request in Postman I get a TaskCreationFailure from the middleware logger, and haven't been able to make much progress on debugging this. Help would be appreciated!

    • @eyo4821
      @eyo4821 10 หลายเดือนก่อน

      This line is in my info output as well if it helps:
      aws_smithy_http_tower::parse_response] send_operation; status="construction_failure"

    • @codetothemoon
      @codetothemoon  10 หลายเดือนก่อน +1

      @@eyo4821 Do you have the DynamoDB table set up and credentials configured in ~/.aws/credentials?

  • @mr-fluffy469
    @mr-fluffy469 ปีที่แล้ว

    what if I need two identifiers at 8:41?

  • @Tszyu01
    @Tszyu01 ปีที่แล้ว +1

    Does anyone have a simple example of using awc or reqwest within an actix handler, awaiting a request to an external api and parsing the response and returning as a Result or similar?

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      I don't have an example handy, I'm assuming you're stuck on converting the results of the reqwest into something that you can return from the actix handler?

    • @Tszyu01
      @Tszyu01 ปีที่แล้ว

      @@codetothemoon that’s pretty much it yes. I think part of the issue is that it doesn’t like the error of request/awc, probably need to update the error_response implementation.

  • @JosephDalrymple
    @JosephDalrymple ปีที่แล้ว

    Any interest in making an example like this using Tokio's new axum framework?

  • @artursradionovs9543
    @artursradionovs9543 ปีที่แล้ว

    Question is - how to learn all this stuff knowing basic RUST?

  • @schabby30
    @schabby30 2 ปีที่แล้ว +2

    Do I actually need an aws account for this? Cause trying to run the code it complains about not having configuration for aws.
    Anyways, awesome content!

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +2

      Yep! Apologies, I should have made this clearer in the video. Create an AWS account, a DynamoDB table with the name and fields used in the program, and an IAM user with DynamoDB read/write permissions for that table. Then run `aws configure` on the machine you're running this app on, paste in the access key id and secret for the IAM user that you created. Then the app should work!
      Separate but related topic - would you like to see more videos about AWS?

    • @schabby30
      @schabby30 2 ปีที่แล้ว +1

      @@codetothemoon thank you, and sure, more aws videos would be even more AWSome :)

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      @@schabby30 i see what you did there!! 🙃

  • @justinjordan5842
    @justinjordan5842 ปีที่แล้ว +2

    bro, whats on your shirt?

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +1

      Mark Rober’s glitter bomb! 😎

  • @rotteegher39
    @rotteegher39 ปีที่แล้ว +2

    enooms xD

  • @alext5497
    @alext5497 ปีที่แล้ว +1

    Is this fireship io? His voice is the same or I imagining

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      That’s a huge complement, thank you 🙏

  • @abraham7966
    @abraham7966 ปีที่แล้ว +1

    What is the best ORM to use with Actix?

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      I think choosing an ORM is sort of orthogonal to choosing a backend framework - the only Rust ORM I've used is Diesel, which many find to be too complicated. I've heard good things about SeaORM but I haven't used it myself.

    • @abraham7966
      @abraham7966 ปีที่แล้ว

      @@codetothemoon Is diesel asynchronous? Meaning, the SQL queries will not block the thread? I wonder how it plays out with Actix which is uses on Tokio

  • @sbrixxo.
    @sbrixxo. ปีที่แล้ว +3

    Is this still a valid solution?

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว +1

      should be! Maybe some of the APIs have changed slightly but afaik this is still valid. Though it's worth pointing out that now we have Leptos which is a great full stack webapp solution that actually uses Actix for the backend - so you can have your frontend and backend in one project ala SvelteKit or Next.js. It's quite nice - video to come soon hopefully

  • @DJenriqez
    @DJenriqez ปีที่แล้ว +1

    actix is nice, but when to come to handling form data with file, things get mad (comparing to python flask for example) :D :D

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      how so?

    • @DJenriqez
      @DJenriqez ปีที่แล้ว

      @@codetothemoon you have to go via multipart class, which si basicaly stream of values names and bytes, and you have to reconstruct that form by yourself. In python flask form is just almost dictionary,…

  • @kickhuggy
    @kickhuggy ปีที่แล้ว

    Am I the only one who can't run and hit my endpoint? Tried watching/rewatching/cloning the code, there's no readme or anything

  • @sunhsiang6644
    @sunhsiang6644 ปีที่แล้ว +1

    Rust: from start to giving up 🤣

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      no don't give up! what are you stuck on?

  • @zhdan5887
    @zhdan5887 9 หลายเดือนก่อน +1

    вот это рыгачка

    • @codetothemoon
      @codetothemoon  9 หลายเดือนก่อน

      english translation is "this is the lever" - what do you mean?

  • @hos7012
    @hos7012 2 ปีที่แล้ว +1

    what keyboard?

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว

      It’s a redragon, link is in the description! Mine is kind of old though, might be a slightly different model

    • @hos7012
      @hos7012 2 ปีที่แล้ว

      @@codetothemoon thx

  • @nicholashendrata
    @nicholashendrata 2 หลายเดือนก่อน

    E-nooms

  • @alivenumber5
    @alivenumber5 8 หลายเดือนก่อน

    How in the world is someone supposed to just "know" all of these steps? The Rust ecosystem seems a bit opaque.

    • @ThomHemenway
      @ThomHemenway 7 หลายเดือนก่อน

      What he did is very similar to other languages in how they stand up APIs

  • @aleemahmed6201
    @aleemahmed6201 ปีที่แล้ว +1

    Why stop there! jsut write machine code instead!

  • @illegalsmirf
    @illegalsmirf 2 ปีที่แล้ว +1

    No thanks

    • @codetothemoon
      @codetothemoon  2 ปีที่แล้ว +1

      What’s the most off putting aspect for you?

  • @kevinxu8134
    @kevinxu8134 ปีที่แล้ว +2

    fastforwarding code typing in the mid of a sec does not make you a better coder.

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      No? Back to the drawing board then I guess 😔

  • @backupmemories897
    @backupmemories897 ปีที่แล้ว +1

    this is top 2 now xitca-web ... its inspired by actix.. and top 1 is drogon-core

    • @codetothemoon
      @codetothemoon  ปีที่แล้ว

      interesting, hadn't heard of this one! wondering if it's aim is to be a full featured framework or just a benchmark exercise...

  • @AbdulWahab-ev2ct
    @AbdulWahab-ev2ct ปีที่แล้ว +1

    I appreciate the time you put into these videos. However, one can easily conclude that Rust does offer security, a fast and efficient application if done right but the developer experience is not good so far at least for me. I mean look at your own example it took so much time and code just to have a simple CRUD API for tasks. I'll stick with the Go for now.
    Go > Rust 🦾

    • @jazz24101
      @jazz24101 5 หลายเดือนก่อน

      I also made the experience that Rust is completely overkill for creating backend APIs, just go with Golang if you want to learn something new or keep to Java, most companies have written their Applications in Java