Learn Node

These are my quick notes from Wes Bos' Learn Node course arranged by modules.

Quick Links:

Module 1: Intro & Set Up

import dotenv from 'dotenv';

dotenv.config(); // if the environmental variable file is simply '.env'
// or
dotenv.config({ path: 'variables.env' }); // if the environmental variable file is 'variables.env'

Module 2 => Module 15

Starting from module 4 I started following a self-documenting git-based learning format which I mentioned here and kind of explained here. Bar those, the headings and bullets which follow contain most of my handwritten notes while traversing the course

On Routing

On Templating

  div.wrapper
    div.inner
      h2#title A Snippet
      img(src="fine-boy.png" alt="A fine boy")
      p This is a snippet
      button Click Me!

translates to:

<div class="wrapper">
  <div class="inner">
    <h2 id="title">A Snippet</h2>
    <img src="fine-boy.png" alt="A fine boy" />
    <p>This is a snippet</p>
    <button>Click Me!</button>
  </div>
</div>

in ‘normal’ HTML.

On the MVC Pattern

On Middlewares

const uselessMiddleware = (req, res, next) => {
  req.remark = 'Attach this to request object';
  next(); // passes execution to the next middleware if available.
};

On the rest

See my follow-along repo’s commit history

Live Demo

A live version of the app built can be accessed here: