The HyperText Transfer Protocol (HTTP) is a specfication for transfering resources over the internet. Invented back in 1989 to support the "World Wide Web",
it has done quite well for itself and hasn't changed all that much three decades. HTTP is simple, works easily with any underlying network and security setup, and
doesn't require extra central organization - features that have led to its wide acceptance, longevity, and stability.
In this step, you will create an HTTP server running on your local machine (aka
localhost
) using node.js and
express.js, the dominant JavaScript HTTP server. Clone the assignment repo,
which has the
.gitignore
file and some HTML mockups that you'll use in later steps. Do your work there in the working directory
so you can easily (and regularly!) commit and push as you go.
prompt> git clone <repo URL>
prompt> cd <repo name>
prompt> git config commit.template .gitmessage
Additional reference: the
express.js install page, with the
npm
project setup commands as used in the video above.
Most of the time, we install nodemon globally (i.e. wherever node is installed) so that it is available in all projects with:
npm install --global nodemon
This can sometimes run into issues with permissions and paths. Alternatively, you can install it locally in a project and use the
scripts
directive in your
package.json
to run nodemon within the
local project environment.
npm install --dev nodemon
{
"name": "my-node-app",
"version": "1.0.0",
"description": "Example package.json",
"main": "index.js",
"scripts": {
"start": "nodemon index.js", # change this to run nodemon on whatever file you are using
},
"devDependencies": {
"nodemon": "^3.0.0"
}
}
npm run start # runs the script, in place of just "nodemon" or "node"