Review/Experience: Wes Bos’s Learn Node Course

A detailed review of Wes Bos’s learn node course from a backend beginner’s perspective.

Arihant Verma
4 min readJul 31, 2017

--

Why I Did This Course:

Three reasons

  1. I didn’t know who Ben Nadal is. Wes tweeted Ben’s review of his learn node course, it seemed pretty good and I went on to the pricing section of the course (because I don’t have a job right now, so resource crunched).
  2. I sent a query to Wes that the prices that he had initially set were too high on Indian standards. He was super nice and asked me to prove that I was indeed an Indian and that he’d give me a discount. Foolish me I didn’t grab that wonderful opportunity. Fast Forward 3 months, he’d already inculcated geo prices. I had this much saving to afford. I dove in. Thanks Wes!
  3. Because I thought I would be able to revise everything while reading the code once again and writing about it parallelly.

What I Expected From The Course:

Its contents. Wes has elaborately explained what he’s taught in each video. Even someone who’s just checking out the course can see the contents on the learn node page. So I bought the course and started it. It took me quite a while since I was traveling a lot, but finally, I did it, yay!

What I Learnt From The Course:

A lot.

  • How to set up MongoDB both locally and online on Mlab (free 500mb plan for development purposes)
  • How to go about environment variables in node and why should one do that (to keep everything modular of course)
  • Pug (previously jade) templating, its syntax and helpers and mixins, and how to globally add some helpers on each request.

At this point of time I’m realising I’m basically elaborating the contents of the videos Wes has already provided on the learn node page. That’s how good the videos are. I’ll try my best to tell things other than the contents themselves. Bear with me.

  • Handling async errors with a curried function instead of catching it individually on every async-await. Pretty neat!

Doing this:

// errorHandlers.jsexports.catchErrors = (fn) => {
return function(req, res, next) {
return fn(req, res, next).catch(next);
};
};
// routes.jsrouter.post(
'/reviews/:id',
authController.isLoggedIn,
catchErrors(reviewController.addReview)
);
  • Global and route based middlewares
  • Advanced aggregation mongoose — mongoDB. Okay, being a database and a backend newbie, I didn’t know the things that I had been doing in a meteor project using javascript could be done more efficiently on the database layer itself, faster, because databases are designed to do those tasks!
  • Geocoding data with Google maps, saving lat and lng of places. This was really fun. This was my first use of google maps api and I know how to dabble with it now.
  • Uploading, Resizing, Saving Images with Middleware using multer.
  • Pre save, find, findOne hooks. Custom code to ensure unique slugs for a particular model (Restaurant Stores)
  • Multiple query promises to save fetching time.
const storesPromise = Store.
find()
.skip(skip)
.limit(limit)
.sort({ created: 'desc'});
const countPromise = Store.count(); //----------------- THIS THING ---------------// const [stores, count] = await Promise.all([storesPromise, countPromise]);
  • Using passportjs, creating user accounts, setting password reset flow.
  • Virtual fields, to link relationships between different models of databases with each others. Kinda like joins in sql (I wouldn’t know I have never used a sql database, I’ve never used anything other than MongoDB. It’s what I heard in the course 😄)
  • MongoDB indexes for faster lookups.
  • Creating API endpoints, creating geospatial data ajax end points.
  • Sending Emails with nodejs (If you are interested in a bulk email campaign that is customised to your needs this is something solid)
  • Creating an ajax search interface
  • Implementing pagination
  • And deploying the app on multiple cloud service providers like now, digital ocean, heroku.
  • XSS Attack demo! Didn’t know about that before, super cool!

All in all, the node course blew my mind because I’m a lazy person, always reading about new stuff, graphql, apollo and what not, and not really being able to curate learning data points and build something on top of them, on my own. This course broke a barrier for me. Even though I was coding as Wes was in the videos, I constantly kept coming back after I had followed along to grasp and retain what was just coded.

I still have a very vague question for Wes though. How did he curate from all around the web and learnt this on his own over the course of 5 months (I guess?). We all course takers know how Wes excellently build the app from the basics, explaining everything in the way, but how did the learning timeline look like?

★★★★★★/★★★★★

Some of the problems I ran into:

Problems I ran into :

E11000 duplicate key error collection: learnnode.users index: username_1 dup key: { : null } (if console logged inside `mongoose-mongodb-errors/lib/plugin.js`).

Actual error:

/Users/gdad-s-river/Documents/code/github/Learn-Node/starter-files/node_modules/mongoose/node_modules/mongodb/lib/utils.js:98
[💻] process.nextTick(function() { throw err; });
[💻] ^
[💻]
[💻] TypeError: Cannot read property ‘1’ of null
[💻] at model.mongodbErrorHandler (/Users/gdad-s-river/Documents/code/github/Learn-Node/starter-files/node_modules/mongoose-mongodb-errors/lib/plugin.js:21:49)

What helped:
https://stackoverflow.com/questions/38347186/mongoose-caused-by-11000-e11000-duplicate-key-error-index

from mongo shell

db.users.dropIndex("username_1")

I still have no idea what made it happen this way, that is a duplicate index name.

A small typo that I saw:

‘addFields’ instead of ‘addField’

--

--

Arihant Verma

I write poetry and short fiction. I meditate, code, dance, sing, play 🏀, clean stuff. I’m a non sticky pan to events 🍳.