- Setup
node
on your computer (skip to step 2 to check):- Download from: https://nodejs.org/en/download/
- Check if node is installed in your system by running the sollowing commands in Command Promt/PowerShell/Git Bash:
node -v
npm -v
- In either case you should see the version of
node
ornpm
installed.
- Client server model: https://www.youtube.com/watch?v=L5BlpPU_muY (6 min)
- HTTP and HTML: https://www.youtube.com/watch?v=1K64fWX5z4U (7 min)
- Video about node: https://www.youtube.com/watch?v=pU9Q6oiQNd0 (13 min)
- https://www.freecodecamp.org/news/how-the-web-works-part-ii-client-server-model-the-structure-of-a-web-application-735b4b6d76e3/ Until
That’s all folks! (Well, sorta…)
(10 min)
Try to formulate an answer to the question:
- What is the server and what is the client?
- What is http?
- What is Node.js?
Teacher Live Coding Videos - https://github.com/HackYourFuture-CPH/teacher-live-coding
- What happens when you open a webpage - Class 1
- What is node js and how to use it - Class 1
- Node js project structure - Class1
- Creating a simple Express webserver in Node js and creating your own modules - Class 1
There are many ways to interact with Node. We can start the environment up in a REPL, we can start it up with a file, we can start it inside a docker container.
After installing NodeJS on your machine, you will have access to the environment by typing node
in the terminal. This will drop you into the node REPL (Read Evaluate Print Loop).
Welcome to Node.js v15.14.0
Type “.help” for more information.
>
In here you will have access to the javascript language. There are limitations, which depends on the version number of Node. The further it progresses in time, the more features will be included.
You can also feed node files to evaluate and this is where node becomes such a powerful tool for any developer, especially frontend developers.
http://ajmalsiddiqui.me/blog/introduction-to-npm-scripts/
- Can serve HTTP responses to HTTP requests.
- Is most often used together with the REST principle.
- The REST principle is an architecture for organising resources.
In many cases we don’t want the web server to just serve information, some of this might be privilege to a user. It can be the responsibility of the web server to also check that the requests it receives has the right authentication required.
The web server rarely has any information or data build into it. It relies on external system build specifically for that purpose and acts as a proxy between the database and the requester. (However node is a general purpose programming language, so it can indeed also be used to write a database system (https://dzone.com/articles/building-a-database-written-in-nodejs-from-the-gro).
Testing is an often used tool in software development to better ensure your code does what you want it to. Booting up a server locally and doing manual testing works to some extent, but this is not manageable or scalable as an application grows.
To help you get accustomed to what testing looks like, each week's homework includes a set of tests to move you along in the exercises. This provides structure for you to better understand what you need to complete and to help you be sure that you are correctly completing the tasks.
If in doubt, from the week's homework
directory from which you are completing the exercises, run (after running npm install
):
npm test
This will give you an idea of the tasks you need to complete.