

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
You may be wondering how the fileserver knew to serve the index.html file to the root of the server. It's such a common convention on the web to use a file called index.html to serve the webpage for a given path, that many file-serving libraries do it automatically.
When using a standard fileserver, the path to a file on disk is the same as its URL path. An exception is that index.html is often served from / instead of /index.html.
Run your chirpy server again, and open http://localhost:8080/index.html in a new browser tab. You'll notice that you're served the same content as if you went to http://localhost:8080/.
This works for all directories, not just the root!
For example:
/index.html will be served from //pages/index.html will be served from /pages/pages/about/index.html will be served from /pages/aboutAlternatively, try opening a URL that doesn't exist, like http://localhost:8080/doesntexist.html. You'll see that the fileserver returns a 404 error.
Let's serve another type of file from our server: an image. Chirpy has a slick logo, and we need to serve it so that our users can load it in their browsers and mobile apps.
http://localhost:8080/assets/logo.png
Run and submit the CLI tests.