Intro

In this section, you will be writing code that runs on the computer using node, an application that runs JavaScript code. Everything in this section is about figuring out how to use the libraries that engineers have written for you to build the application you want.

Preflight

Before you start, make sure you understand these concepts.

  1. (line by line) node app.js runs a file called app.js. When a file is run, the computer will go through the code, line by line starting at the top.

    // app.js
    const fruits = []
    fruits.push('apple')
    console.log(fruits)
    

    Let's say you run the file a few times:

    node app.js
    node app.js
    node app.js
    
    // What gets printed out?
    
  2. (async) Make sure you understand the async nature of JavaScript!

    let counter = 1
    setTimeout(() => {
      console.log(counter)
      counter = counter + 1
    }, 1)
    console.log(counter)
    // what gets printed out?
    
  3. (Non-Primitive) Make sure you understand the nature of objects in JavaScript!

    const data = {}
    setTimeout(() => {
      const newObj = data
      console.log(newObj.name)
      newObj.name = "hello"
    }, 10)
    setTimeout(() => {
      const newObj = data
      console.log(newObj.name)
      newObj.name = 300
    }, 5)
    console.log(data.name)
    

Overview

First you will use a few libraries to help you learn the underlying concepts behind the internet. Once you understand these concepts, we will go over some problems that companies face when trying to scale their technology to prepare you for system design.

Previously, you learned that URL is made up of the protocol, hostname, path, and query parameters.

We can pass data into a request by using the URL's query parameters.

https://www.gilliganondata.com/wp-content/uploads/2012/05/url_anatomy.png

In this chapter you will learn other ways of sending data to the server. Everything you learn will only be applicable to the http or https protocol. The protocol is the first letters before :// in a url.

Quick overview of other protocols (Feel free to read more about these, but you are not expected to know these in your day to day role as a software engineer).