Grokking Node.js
0% completed
Serving Static Files with Node.js
A short static file server can also send your .env file, with its passwords and API keys, to any visitor who asks for it. This lesson builds a static file server step by step, shows the exact request that exposes such a file, and then closes that hole.
Files that the server sends exactly as they are stored on disk, such as HTML pages, stylesheets, browser scripts and images, are called static files. Every visitor gets the same bytes, unlike the routes of the previous lesson, which built each response in code. The examples use two files. The first is index.html:
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%