

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Welcome to Web Servers
incomplete
2: Async TypeScript
incomplete
3: Setup
incomplete
4: Build
incomplete
5: Server
incomplete
6: Fileservers
incomplete
7: Fileserver Quiz
incomplete
8: Serving Images
incomplete
9: Workflow Tips
incomplete
10: Custom Handlers
incomplete
11: Request, Response
incomplete
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
In a way, this course is where everything you've learned so far on the Boot.dev back-end path comes together. Building HTTP servers is the bread-and-butter of a back-end developer's day-to-day work.
This course assumes you already have a solid understanding of TypeScript.
A web server is just a computer that serves data over a network, typically the Internet. Servers run software that listens for incoming requests from clients. When a request is received, the server responds with the requested data.
Any server worth its salt can handle many requests at the same time. In TypeScript, we use asynchronous functions and the event loop to handle many requests concurrently. Let's start by practicing with asynchronous functions.
In this course, we'll be working on a product called "Chirpy". Chirpy is a social network similar to Twitter.
One of Chirpy's servers is processing requests unbelievably slowly. It's processing every request using async/await.
Notice that the server times out after 5 seconds and the requests can't finish. That's because they're being processed one-by-one sequentially - each request takes 2 seconds, so 4 requests would take 8 seconds total.
await Promise.all(reqs.map((req) => handleRequest(req)));
This uses Promise.all to run all the requests concurrently instead of sequentially. Now all 4 requests will run at the same time and complete in just 2 seconds.