

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
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
We're building a fully-fledged web server from scratch on your local machine. The test suite will make HTTP requests to your local server over localhost. Your server will run in one terminal, while you submit tests with the Boot.dev CLI in another terminal.
Express makes it easy to build a simple server in Node.js. Calling express() creates an application that can receive HTTP requests. Because the application won't have any routes yet, it will respond to every request with 404 Not Found.
Start the server by calling the application's .listen() method with the port on which it should listen for incoming requests.
Being a programmer means reading documentation and searching for examples. We're already telling you everything you need to know to build Chirpy, but we don't want to rob you of valuable practice reading the docs and learning from examples. Read Express's Hello World example as a primer.
Reading documentation is an essential skill because a professional in any field should never stop learning. In fact, the best way to learn is on the clock.
Build and run a server that listens on port 8080 and responds to every request with 404 Not Found.
npm install express
npm install -D @types/express
In another terminal window, while your server is still running, run and submit the CLI tests.
If the bootdev CLI requests a URL other than localhost:8080, your ~/.bootdev.yaml file may have the base_url set from a different course. Run bootdev config base_url --reset before running the tests again.