
Lesson Description
The "Node.js & Servers Overview" Lesson is part of the full, API Design in Node.js, v5 course featured in this preview video. Here's what you'd learn in this lesson:
Scott explains the differences between Node.js and browser JavaScript, noting the browser’s focus on DOM and HTTP calls versus Node.js’s server-side tools like file access and server building. He also covers package.json for dependencies and tsconfig.json for TypeScript setup.
Transcript from the "Node.js & Servers Overview" Lesson
[00:00:00]
>> Speaker 1: In the browser, JavaScript, depending on the browser you have, might be using something like V8, SpiderMonkey in Firefox Does anybody know what a JavaScript engine is
[00:00:00]
What does that mean Has anybody ever thought about or experienced what a JavaScript engine is I'm not someone who writes compilers, but I did dive into this a long time ago when I was first getting into teaching
[00:00:00]
I was fearful that someone in this audience might ask me about it and make me look stupid, so I started learning about it It's essentially a compiler that compiles down to a C language, which then compiles down to machine code that gets read by the computer
[00:00:00]
Each browser is built on its own version of an engine V8 is Chrome's engine Apple has.. I'm not even sure what Apple uses anymore I think Internet Explorer might have used V8 or WebKit
[00:00:00]
I honestly can't keep up, but these are engines you'll never have to interact with unless that's your job The primary purpose of JavaScript in the browser is basically to manipulate the DOM, handle UI interactions, and make HTTP calls
[00:00:00]
We all know the global object is the window We have DOM APIs and web APIs that we take for granted The browser protects us with built-in security The browser's main workhorse, in my opinion, is security
[00:00:00]
If browser specifications weren't created, the first Chrome extension you installed could have compromised your computer The browser sandboxes your environment
[00:00:00]
Today, browsers do have native module systems Most modern browsers support ES modules, though most developers still use bundlers like Vite and Webpack Node.js uses Chrome's V8 engine at the operating system level
[00:00:00]
You can run JavaScript in your terminal with Node, using the same JavaScript features (not APIs) as in the browser The primary purpose of Node.js is to build servers, access file systems, and do things that would seem like wizardry to non-technical people
[00:00:00]
In Node.js, there's no window object Instead, there's a global object literally called "global" It provides APIs for file systems, networking, process management, cryptography, and security – though security is something you'll need to implement yourself
[00:00:00]
Historically, Node.js used CommonJS modules, but recent versions support ES Modules (ESM) From a frontend engineer's perspective, understanding how servers work is crucial
[00:00:00]
When you fetch an API on the frontend, someone has to create a route on the backend to handle that request The key difference between client and server is resource sharing
[00:00:00]
A client app (website, mobile app, smart TV app) runs on an individual machine, while a server is a central computer shared by multiple clients If a client-side app crashes, it's usually not a big deal
[00:00:00]
But if a server crashes, no one can use the service There are different types of backend services:
- Long-lived servers: Continuously running processes
- Serverless functions: Activate only when a route is hit
- Edge functions: Compute running on a Content Delivery Network (CDN)
- Background jobs: Tasks that run separately from user interactions
- Cron jobs: Scheduled tasks running at specific intervals
Each of these serves different architectural needs in modern web development.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops