🔓 Opening a Web App
• Scenario: Three users open Twitter from different devices:
• Michael on a Mac (his personal feed).
• Rich on Linux (tweets about Node.js).
• Zep on a phone (Twitter homepage).
• All open Twitter via a web browser, which means loading a web application.
📦 Web Application Needs
To load a web app, two things are required:
1. Code written in:
• HTML → defines the structure and content.
• CSS → styles and beautifies the content.
• JavaScript → handles logic and user interaction.
2. Data, e.g., tweets, images, videos.
🌐 Where Do Code & Data Come From?
• From a server, which is just another computer that's always connected to the internet.
• When a user opens Twitter, their device sends a request to Twitter's server asking for code
(HTML/CSS/JS) and data (tweets, images).
💬 Client-Server Relationship
• User devices (Mac, Linux, phone) are clients.
• Twitter's machine is the server.
• Clients send requests, and the server responds with the appropriate content based on the
request.
🖥️ What Controls the Server Response?
• The server must inspect the incoming request and decide what content to return.
• This logic is written as code on the server.
🧾 Choosing a Programming Language for the Server
• Possible languages: PHP, Java, Ruby, C, C++.
• Ideal dream: reuse JavaScript on the server as well, since frontend developers already know
it.
⚙️ What Is a Server Really Doing?
To respond correctly, the server needs to:
• Access incoming network requests.
• Read files (e.g., HTML, CSS, JS).
• Retrieve data from storage or a database.
• Send a response back.
To do this, it needs access to internal features of the computer such as:
• The network card
• The file system
• The operating system APIs
🤖 Can JavaScript Do This Alone?
• No. JavaScript in the browser cannot access low-level computer features.
• Languages like C++ can access the operating system and hardware directly.
🧩 Solution: Node.js
• Node.js = JavaScript + C++
• JavaScript provides the high-level logic.
• C++ provides access to the low-level system features.
• Together, they enable developers to use JavaScript to control server behavior.
🧰 Node.js Tools & Modules
• Node exposes key features through built-in modules:
• http for networking.
• fs for file system access.
• These are JavaScript labels that internally call C++ functions.
🎯 Goal of the Course (as per Will Sentance)
• Learn how JavaScript (via Node.js) controls the server.
• Understand how JavaScript triggers C++ features to access system resources.
• Focus on mental models, not learning C++ syntax.
• Build intuition for how Node.js empowers JavaScript to serve as a backend language.