Building a Web Server in Rust - Part 1

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ต.ค. 2024

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

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

    📝 Get your *FREE Rust cheat sheet* : www.letsgetrusty.com/cheatsheet

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

    What a wild and cool tutorial! I expected to see a framework like Actix or Rocket. But this is waaaay more interesting!

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

      Axum is another rising web framework.

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

    bro, you're the man, you're the square root of man, you're the raw format of man, you're deep of the man

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

    I need a rust best practice series with examples

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

      Definitely on my list of video series to make!

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

      Yeah

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

      There is also the clippy tool which looks at your code and warns when something could be done better!
      It can be run using cargo clippy.

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

      @@remrevo3944 it's more about local things to improve. But I mean most global: architectural, structural, logical. No tools can check those things

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

      @@oliverfoxi Okay yes. That's also very helpful.

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

    build CRUD project with framework would be great!!!! I love you man

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

      Has he donde this already? do you know?

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

    The refactor with the variable deconstruction including the if baffled me. Didn't expect it to work as is.
    Would be nice to got into that a bit more.
    Also a follow-up with error handling this code would be a good addition.
    Thanks a lot for your good work. I enjoy this level of explanation, with quick reminders for everyone to be able to follow.

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

    Can't wait for the next part! Great job making it all the way to the end of the book with these videos, they are awesome!

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

    Thanks for this awesome tutorial.. I heard about rust and I found it little bit complicated but I don't know why after this video I'm excited to make my first real web server that handles all methods get post put socket... 😅

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

    Excellent vídeo. I like this project. Implements using HTTP 2.0 and 3.0(QUIC).

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

    You have helped me learn a lot in just this one video, Thankyou very much sir!

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

    Oh I was looking for part 2 and just noticed this video is from today lol

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

    Maaaan I really hope some day this channel touch at least the pilars for Solana project and how Rust will change the future for Web. 🤟🏽

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

    finally a coherent approach instead of some framework

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

    Thanks for this video. I was looking forward for it.

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

    Very well explained video. I'm not really a Rust developer, but I'd love to see database CRUD thrown into this server, with some templating syntax on display.

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

    Thanks for this

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

    this tutorial is amazing! not only do I now know networking in rust but I also published a crate with the knowledge i gained from this tutorial (its called haws if you're interested) keep up the good content, Long live rust

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

    Been watching through your back log and I gotta say you’re fucking killin’ it

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

    Thanks for the video. Your videos are very important!

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

    In an HTTP response message, after the headers, before the body, there is an empty line (just CRLF =
    ) to indicate that the headers are over.
    So
    - status line CRLF

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

    What are you going to do after you're done with the book.

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

      I’m going to retire

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

      @@letsgetrusty if you retire you’ll get rusty

    • @hurricane-rus
      @hurricane-rus 2 ปีที่แล้ว

      We hope, for a week or two?

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

      @@letsgetrusty Noooooo

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

    Nice job Bogdan. I like to see some rpa based projects.

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

    Finally a good chapter. :)

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

    Excellent tutorial sir. Pls help to have tutorials on writing more protocol servers in rust like using FIX trading exchange protocol

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

    this content very usefull for me, Thanks a lot

  • @user-fi5ml8is5o
    @user-fi5ml8is5o ปีที่แล้ว

    Good job, you saved my ass! thank you very much.

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

    I could use this to replace Node JS and PHP. Thanks.
    I'm curious what programming features I can implement into a custom web server.

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

    What extension gives you the ```addr``` intellisense as shown when creating your listener in main? Check 2:40 in video

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

    Totally awesome! Thank you.

  • @skylark.kraken
    @skylark.kraken 9 หลายเดือนก่อน

    Here from the newsletter. I am a backend developer using Rust and one of the biggest features is that I can trust it to run on its own. Once a server is made and running it doesn’t need to be touched again, it can’t crash because every problem is dealt with.
    I just have to be aware of security updates which there aren’t many of because of Rust’s language design meaning that basically only logical bugs can cause security vulnerabilities and it’s usually some library that isn’t considered safety critical providing an entry point.
    When I used to write servers using Node.js security vulnerabilities were constant and many libraries would be depreciated and replacements will need to be found and replaced in code. Rust libraries aren’t more likely to not become depreciated but they’re more likely to be completed and not need further updates

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

    Making CLI app with rust. I am waiting for this tutorial

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

    I would like to see server implementation based on raft consensus protocol. :) Right now I am trying to understand and implement it.

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

    Nice

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

    This is awesome! Thank you!!!!

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

    thank you! Amazing!

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

    Thanks you!

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

    Time for “effective rust”

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

    Great videos I mean all of them are just very good

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

    Perfect job again!

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

    great content, but gotta turn off those LSP popups that obscure the rest of the lines, forces pausing.

  • @elalemanpaisa
    @elalemanpaisa 16 วันที่ผ่านมา

    I always thought compared to Go Rust is such a pain in the butt to develop for web apps and you have to write massively more code which doesn't seem the case that much

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

    I don't think you need to import prelude at all at 6:12 - I don't.
    Maybe the difference is the rust version, I'm on 1.65.0

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

    This was amazing

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

    One thing I really wanna see is doing encryption in rust

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

    When will Part 2 be out! Excited to finish this whole series

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

    Exactly how is HTTP protocol out of scope if you are writing an HTTP server?

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

    super helpful

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

    Hey Bogdan, in my project I'm not seeing a src and target in the file explorer. Any ideas why that might be? Thanks for the informative video. 10:42

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

    Heyyy, do you think that to learn RUST I should know any other language first? Or is it independent from the others?

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

      Other languages are easier to learn (ex: Python, Java, C#) but you can start with Rust if you wanted to.

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

    bro how to implement a basic level of OS in rust. Make a video on that also plz.

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

    what is the difference between rust and apache? when i search normal web development videos i dont see these types of coding

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

    A custom TCP protocol project would be helpful.

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

      Jon Gjengset has a small series on implementing TCP in rust, can really recommend his videos.

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

    can you share repo link if possible with timestamp tags

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

    Do you have a video handeling errors?

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

      I have a video about error handling as described in the Rust book but this topic is complex enough that I will be making another video in the near future diving deeper.
      Error handling video: th-cam.com/video/wM6o70NAWUI/w-d-xo.html

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

    I turned on the captions and somehow it reads - "What's up breast stations"

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

    why not use actix web or rocket ?

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

      Will make videos using those frameworks in the future. This video is following the Rust book.

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

      @@letsgetrusty use Yew pls front end, with webassembly stuff. The real power of rustttttt

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

    project request: building graphQL server with rust

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

    Awesome

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

    so stream takes in a type of TcpStream,. eh?

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

    I'll like to see a small contract project base in rust

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

    why not use rocket

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

    Did any guy face this issue: every time I stop debugging and restart it, a message will show and say"Address already in use." My environment is Raspberry 4 and the OS version is 5.15.61-V7l+.

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

      this is normal, cause your are interrupt working process abnormal way. So you need to kill port process, something like kill -9 $(lsof -t -i tcp:3000)
      , where 3000 is a your port addr.
      Or you may handle some route for "normal" server interruption at debugging stage.

  • @ari-mcbrown
    @ari-mcbrown 2 ปีที่แล้ว

    I forsee System 76's Cosmic DE, needs to be renamed to System (76+2)²

  • @florentd.5817
    @florentd.5817 8 หลายเดือนก่อน

    Take a look at rust sws stactic web server.

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

    nice video, I was reading this chapter in the rust book but I didn't understand at all , this video clarified my doubts

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

    read takes a mut stream because some internal state of stream got modified? that sounds like a very sad design. why would a read uesr ever needs to know anything internal?

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

    hahaha spells out rust on the telephone lol 2:53

  • @ImranSheikh-kg4qd
    @ImranSheikh-kg4qd 2 ปีที่แล้ว +1

    Rust Beginner Project

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

    In real projects people use async framework

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

    Build out a simple booking server

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

    Actix/Rocket,diesel Tutorial

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

    0:59
    Its no point trying to make things overly beginner friendly.
    More people will be able to watch your video, and they will watch it for longer, but at the end of the day they will just be copying line by line without understanding whats going on
    You should mention prerequisites and not explain every little thing
    They will understand that they should learn some more basic Rust and come back. (And recommend the Rust book, IMO the best resource for Rust)

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

    It's cool to build a Rust webserver... Until you try to look for a server to host it on, then realize in dismay it's not that easy to deploy :/

    • @herrlehrer1479
      @herrlehrer1479 6 หลายเดือนก่อน

      What do you mean? Anything can run rust.

    • @megumin4625
      @megumin4625 6 หลายเดือนก่อน

      @@herrlehrer1479 Not any host can no (when referring to webservers). Some webhosts for example have apache/nginx servers with php, html, etc (basically, the way things used to be). Not every host allows you to just run an exe/elf

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

    OOOOORR save yourself 90% of the headache, and switch to the one and only language y'all should be using ;)

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

      Mmm I like fast code too much

    • @ikazuchi-san5772
      @ikazuchi-san5772 2 ปีที่แล้ว +9

      you mean rust right?

    • @தமிழோன்
      @தமிழோன் 2 ปีที่แล้ว +9

      Yeah, nah. We're good with Rust - the most beautiful, fast, safe, and efficient programming language in the world. :) Rust is not that hard to learn. I'm a JavaScript developer and the last time I used C/C++ was back in uni lol. But yet, I learnt Rust a lot sooner than I expected. There's literally no headache when dealing with Rust.

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

      This tutorial video has made me really respect rust developers. The salary for rust developers should start at 400k for all this hardwork. All this, Just to implement a web server??😭..

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

      @@தமிழோன் Im a js developer too. What do you respect to read more over for better understanding rust?

  • @sunilk9760
    @sunilk9760 4 หลายเดือนก่อน

    राघव चड्ढा की चड्ढी गिली हो गई विभव की बॉडी देख कर

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

    if anyone else is getting the issue where the browser doesn't render your HTML and just prints it out instead add the Content-Type tag to the header you send.
    format!("HTTP/1.1 200 OK
    Content-Length: {}
    Content-Type: text/html; charset=utf-8

    {}", contents.len(), contents)