Node.js: Token based Authentication, Rest API Testing and Debugging in VSCode
Do you want to implement token based authentication and REST APIs in Node.js with testing methods? Here is series of posts divided into 3 parts:
Part 1: Token Based Authentication with Node.js, Express, Mongoose and Passport

The part 1 covers:
– How to setup express based application
– How to develop REST APIs
– How to implement token based authentication using Passport, JWT and bcrypt
– How to configure ES6 application with Babel
– How to test REST APIs with Postman

I am fan of default asp.net mvc file structure so tried to follow the same structure in Node.js.
Initially the project is generated by express-generator then the needed packages (mongoose, bcrypt-nodejs, jsonwebtoken, passport, passport-jwt,..etc) are installed.
User and Project Models are created.
Auth and Project controllers are created.
Passport is configured and then routers are setup
Babel is used to turn our ES6 code into ES5.
Then start the app and test the APIs in postman. For detailed, step by step, read full Part 1 tutorial.
Part 2: Node.js: REST API Testing using Mocha, Sinon and Chai

This tutorial covers:
– How to test REST APIs using Mocha, Chai and Supertest
– How to manage authentication and token for testing
– How to use Sinon stub to skip Passport authenticate
– How to run Mocha ES6 test with Babel
For detailed, step by step, read full Part 2 tutorial.
Part 3: Visual Studio Code: Debugging ES6 Mocha tests with Babel

This tutorial covers to debug ES6 Mocha code directly with Babel in visual studio code. For detailed, step by step, read full Part 3 tutorial.
Enjoy VSCode and Node.js !