Lesson 31/100

Tutorials MEAN Stack Tutorial

Node.js Fundamentals — Complete Guide

Node.js Fundamentals — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of MEAN Stack Tutorial on Toolliyo Academy.

On this page

MEAN Stack Tutorial · Lesson 31 of 100

Node.js Fundamentals

StackProjects

Stack · 1 — Pieces · ~6 min · MEAN — Node.js & Express

What is this?

Node.js runs JavaScript on the server with modules, npm packages, and a non-blocking I/O model powering MeanVerse Express APIs.

Why should you care?

Understanding require/import, process.env, and the module system prevents mysterious startup failures in production.

See it live — copy this example

Paste into your MeanVerse project (Angular + Express + MongoDB), then run with ng serve / node / mongosh as noted.

// api/src/server.ts
import http from 'node:http';
import { env } from './config/env.js';

const server = http.createServer((_req, res) => {
  res.writeHead(200, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({ service: 'meanverse-api', uptime: process.uptime() }));
});

server.listen(env.port, () => {
  process.stdout.write(`Listening on ${env.port}\n`);
});

What happened?

  • node:http is built-in.
  • process.uptime() shows seconds since start.
  • env.port centralizes config — same pattern before adding Express.

Practice next

  1. Run node -e "console.log(process.version)".
  2. Create server.ts and start with ts-node or node.
  3. Import a local module with relative path.
  4. Switch to createServer with Express app.listen delegate.
  5. Log process.memoryUsage() after warm traffic.

Remember

Node = V8 + libuv + standard libraries. Modules isolate code; npm manages dependencies. process.env drives configuration.

API health probe

Kubernetes liveness checks MeanVerse /health endpoint.

Outcome: Minimal Node handler proves process is alive.

Interview prep for this lesson

Practice these questions aloud after reading—each links to a full structured answer.

Junior Detailed
Explain JavaScript in the context of MEAN Stack.
Short answer: JavaScript runs single-threaded with an event loop. Closures capture lexical scope; promises/async handle I/O without blocking the UI thread. Real-world example (ShopNest) On the ShopNest storefront UI, thi…
Mid Detailed
What are common mistakes teams make with Components when using MEAN Stack?
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. Explain a bit more How to structure your answer (60–90 seconds) Define Component…
Senior Detailed
How would you debug a production issue related to State in a MEAN Stack application?
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. Explain a bit more How to structure your answer (60–90 seconds) Define State in…
Junior Detailed
Describe a real-world scenario where Performance mattered in a MEAN Stack project.
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. Explain a bit more How to structure your answer (60–90 seconds) Define Performan…
Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

MEAN Stack Tutorial
Course syllabus

MEAN Tutorial

MEAN — Stack Foundations
MEAN — Fundamentals
MEAN — TypeScript & RxJS
MEAN — Node.js & Express
MEAN — & Databases
MEAN — Authentication & Security
MEAN — Real-Time & Advanced Systems
MEAN — Performance & Testing
MEAN — DevOps & Deployment
MEAN — Enterprise Projects
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details