Node.js Blog Tutorial

Nodejs Blog Tutorial

In this tutorial we are going to build a blog powered by Node.js on the back end, Bootstrap on the front end, and MongoDB as the data store. We are going to start from scratch and build out the project one step at a time. We’ll see how to include all the packages we’ll need into Node for building the blog. Some of these include Express, Bcrypt, nodemon, express-edge, mongoose, body-parser, express-fileupload, and express-session.…

Node MongoDB Native

Node MongoDB Native

In this tutorial we’ll take a look at creating a simple application to track stocks in a watchlist or portfolio. In order to store this data, we’ll be using MongoDB – a popular NoSQL storage solution that is often used with Node.js. We’ll see how to create the directory structure to hold this stock watchlist application, and then install MongoDB Native using npm to save it as a dependency to the package.json file.…

JSON Web Token Authentication With Node.js

JSON Web Token Authentication With Node

Let’s now protect some endpoints by making use of JSON Web Tokens. What are JWTs? JSON web tokens are base64url encoded JSON Objects which are encrypted by the use of a private key. Embedded within the JWT can be one or more sets of name and value pairs. You might have things like a user id or user name embedded within the token. You can not see this data thanks to the encryption in place, but it can be deciphered on the server since the private key is available to the application.…

How To Add Routes and Models To Node Rest API

How To Add Routes and Models To Node Rest API

At the conclusion of our last tutorial which looks at working with Models in Mongoose, we now have a REST api which allows us to create new users and authenticate users. In a prior tutorial we also built out a restful resource for Games. In other words, we were able to create, read, update, and delete Games using the Node powered api. Now, we’ll once again go over the process of how routes files and model files work together in an express app.…

Information Expert Principle Applied To Mongoose Models

Adding a method to a Mongoose Model

In programming the Information expert, or the expert principle, is an approach used to determine where to delegate responsibilities. In other words, where should you place the code that completes specific tasks. The Information expert principle will help a developer to place the responsibility in the class with the most information required to fulfill it. In this tutorial we are going to clean up the process of generating JSON Web Tokens to make our code more clear and easier to maintain.…