Coding a Web Server in 25 Lines - Computerphile

311,483
0
Published 2024-02-22
Just how simple can a web server be? Laurence Tratt, Shopify / Royal Academy of Engineering Research Chair in Language Engineering at Kings College London builds it up.

More about Laurie: bit.ly/C_LaurenceTratt

www.facebook.com/computerphile
twitter.com/computer_phile

This video was filmed and edited by Sean Riley.

Computer Science at the University of Nottingham: bit.ly/nottscomputer

Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharanblog.com/

Thank you to Jane Street for their support of this channel. Learn more: www.janestreet.com/

All Comments (21)
  • @AndreDeLimburger
    The joy of modern programming languages. Listening on a socket in just one line.
  • @samwalker4438
    I loved Laurie’s smile each time he wrote something he knew was absolutely dodgy!
  • @uuu12343
    He is a gift that keeps on giving A fundamental explanation of making a simple webserver in 25 LOC for easy understanding of its components A lecturer that 1. Uses Rust 2. Uses a framework laptop 3. USES NEOVIM very nice
  • @wildwestrom
    Programming Rust on a Framework laptop running OpenBSD. Absolutely based.
  • @OldShatterham
    Honestly I didn't expect the fundamentals of HTTP to be so easy. This sort of "from-the-ground-up" approach was really fun to watch!
  • @vercolit
    I had this professor for a few lectures in my undergrad during covid. He was very enthusiastic, funny and explained things really well. He was also was explaining concepts with his neovim + rust setup. Happy to see him again on computerphile!
  • @dylanmeeks54
    Rust user? Framework laptop owner? Based prof.
  • @NetherFX
    The funny thing is, there's an async tutorial in the Rust Book that explains how to use threads with a web server do handle 4 workers. If I remember correctly it's not even 10 lines more. Would've been a cool addition!
  • 'I am abusing this monstrously.' == always the sign of well-written code.
  • @vincei4252
    You can build the web server in one line of code if you put your 25 lines of code in a library. 😂
  • @nullptr.
    You can tell this guy loves what he does. Thanks for the video!
  • @pmmeurcatpics
    Don't know if it's a coincidence, but the code really reminded of the one in the first chapters of the Rust Book – Building a Multithreaded Web Server. I've just been reading it a couple of weeks ago, and can definitely recommend taking a look if you're interested! Though it's worth mentioning that the code does contain some difficult Rust
  • @TheHenrik225
    Great format for explaining web servers. Those 17 minutes flew by
  • @Norman_Fleming
    it is important to remember that whichever end you are writing, you need to consider the other end a bad actor or buggy AF.
  • @teej_dv
    TELESCOPE USED!! LETS GOOOOOOO!!!!!
  • @Meow_YT
    "In 25 lines" is doing a lot of heavy lifting with those libraries wrapping so much networking code.
  • @Sonex1542
    This was awesome. I was a programmer, now a DBA. Having someone explain code like this is what a learning experience should be.
  • @lanatrzczka
    Even before the rest was completed, just the bit that sent back "Hello Computerphile" was totally amazing to me.
  • @Lurco8
    Fantastic content, that's what I was always missing in the "basic" server setup - the way the server actually functions!
  • @linuxguy1199
    Nice! One of my first projects was writing my own webserver in Java, later added PHP support and used it to host my website.