Implementing a Service Worker

I listened to a Udacity course on offline first and it was sometimes fairly hard to follow the implementation of a Service Worker. Since then I became a lot more familiar with this topic and rest assured, offline-first is an awesome experience. And actually, it’s a lot simpler to implement the basic functionality, than I thought.



Tagged with
Comment

The best NodeJS text generator

I needed something like a lorem ipsum generator today and I just made the best NodeJS text generator ever. Or maybe not. Time will tell 🙂 In any case, if you need to generate dummy texts with semi-random words, like:
Integisq dolalinsea legide moricapr, taneli lab adoriqid conacu perarinseru.
Please feel free to get the random-textblock package from npm. Usage is pretty simple, maybe event a bit too simple at the moment, but planning to add a few more features.



Tagged with
Comment

Social login in Express applications

I already created a sample project which implements local password authentication in Express. In this post I extend this application with social login options, including Facebook and Google. And once it’s done, it should be fairly straight forward to add any other authentication strategies to you project.



Tagged with
Comment

Express authentication sample project

I’ve created a little sample project which implements local password authentication in an Express application. I pretty much did the same thing already in the previous post, but in that case I used an already existing project. This one is a bit cleaner and it implements a simple frontend, using Pug, Bootstrap and jQuery validate.



Tagged with
Comment

NodeJS password authentication

After learning a little bit about how to start, integrate with MongoDB using Mongoose and how to test a NodeJS-Express application, it’s time to hide some functionality from unauthenticated users. I will skip the option now to build a basic authentication from scratch and will look into PassportJS instead. In this post I will add a simple local password authentication to the example NodeJS project, where the credentials are stored in a MongoDB database.



Tagged with
Comment

Start testing NodeJS – Mongoose

Before continuing to create the REST API which I started and extended in previous posts, let’s take a look at testing. I should’ve started with this I guess, but maybe it’s not too late yet. In the previous posts at the end we tested the results manually either using Postman or cURL. These tests were of course nowhere near complete and if we broke something it remained hidden for too long. In this post I will create some tests for this NodeJS application, first focusing on the MongooseJS models, then in a next post taking a look at testing opportunities of the ExpressJS routes.



Tagged with
Comment

Populate fields with Mongoose

There is no join in MongoDB, but using the populate function of Mongoose we will return merged documents from the ExpressJS project which was created in previous posts. So far we only had the Entry objects defined, now I will extend the REST API a little bit and introduce a new model. Then we will see how to fetch the related documents in one query.



Tagged with
Comment
Just a mongoose

Using Mongoose with Express

In this post I will start MongoDB on my local machine and use Mongoose to describe the objects we used in the previous post, where I started creating an ExpressJS project. We will create a schema to define our object model, add some validation and update the routes we created to use the new backend. We will also take a look at a managed MongoDB service mLab, which offers Database-as-a-Service and has a free sandbox.



Tagged with
Comment

Create your first NodeJS middleware with Express

You can build your NodeJS middleware using the http module, but it will be a great deal more efficient using a framework. The most popular web application framework for node is Express. In this example we will create a very simple server, providing static content. We will take a look at basic routing and serve JSON objects via a RESTful API. In an upcoming post I will give some insights to the client and backend side, for now we will test it using Postman.



Tagged with
Comment