Node Application Patterns: Integrating into a Web App

RobC

Rob Conery teaches Node JS

Welcome to the final part of this review of the Pluralsight course Node Application Patterns by Rob Conery

Rob has been working in the technology field full time since 1998 as a DBA and then a web developer.

His original focus was the Microsoft ASP.NET stack, building tools like Subsonic and the first Micro-ORM: Massive. He co-founded the online training site Tekpub.com with James Avery and co-host This Developer’s Life with Scott Hanselman.

Tekpub was bought out by Pluralsight and he worked there for two years. He is currently working on a new book called The Imposters Handbook.

Node Applications Patterns is the final course in the Node JS learning path.

 

Integrating Our Module into a Web App

Creating an API with Index.js

With events, any subscribers can do what they like. Our index.js will use events like the rest of our module.

This lesson uses a test after development, rather than test first development approach.

Plugging into a Web App

Rob discusses versioning and dependencies. He installs passport:

npm install passport

Passport is like Forms Authentication in .NET. Rob runs through the Passport documentation step by step.

First we set passport’s strategy (there are now hundreds available. we use the local strategy)

npm install passport-local

We use our new membership module in the passport.use LocalStrategy function.

Install the dependencies for express with:

npm install -d

Rob says Express works with middleware in a very elegant way, allowing us to chain any methods we want into the route definition function.

We see how to create functions for passport.serializeUser and passport.deserializeUser.

Rob also talks about plugging a global function into the Route definition.

For more information on using Passport, see Jonathan Mill’s Node.js structure and 3rd party APIs.

Summary and Goodbye

Rob concludes by saying if you come from a procedural/object-oriented background, making the transition to Node requires patience and effort.

At the time that this course was created, he had been working with Node for a year and a half.

If you enjoyed this course, I think you’ll love his course Node.js Testing Strategies.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s