This blog post is part of the series “Learning web development” – which teaches people who have never programmed how to create web apps with JavaScript.
To download the projects, go to the GitHub repository learning-web-dev-code
and follow the instructions there.
I’m interested in feedback! If there is something you don’t understand, please write a comment at the end of this page.
In this chapter, we install a package manager for our operating system. That enables us to install shell commands that we can’t get via npm.
So far, we have used npm for installing shell commands. However, its range is mostly limited to code written in JavaScript. Some important shell commands are written in other programming languages. For those, we need an operating system package manager. Popular ones include:
We’ll use the term native for binary code that can be run directly on an operating system. JavaScript shell commands are not native: We need a JavaScript engine to run them.
curl
When working with HTTP(S), there is one very useful native shell command: curl
. It may already be installed on your operating system. You can check like this:
curl -h
If you don’t get an error message then curl
is already installed.
curl
via a native package manager This is how you can install curl
:
curl
curl
curl
Let’s quickly try out curl
. The simplest way is to use it as follows: It downloads a resource from the web and prints it to the terminal:
curl https://example.com
curl
has many more features. Check curl.se
for more information. One thing it can do is display response headers – e.g. the ones we get from our authenticating web server:
cd http-authentication/
npm start
Once the web server runs, open a new shell and enter the following command:
curl -i http://localhost:3000/
That prints (e.g.) the following information to the terminal:
HTTP/1.1 401 Unauthorized
Content-Type: text/plain
WWW-Authenticate: Basic realm="Users"
Date: Mon, 15 Sep 2025 15:45:48 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked
401 Unauthorized
Most interesting are:
HTTP/1.1
401 Unauthorized
text/plain
WWW-Authenticate