Express API with autogenerated OpenAPI doc through Swagger

In past years OpenAPI has arise as the preferred way to document APIs. In this article we will see how easy is document an API created with NodeJS and Express through the Swagger tools.

If you are working in an REST API you more probably will desire to have some API doc where your users could find what are the endpoints of your API, what they do, which parameters they accept and which output they generate.

»
Author's profile picture acanimal

Joppy, the Tinder for tech recruitment

TLTR: This post is about Joppy, a new service I’m working on that tries to eliminate the pain currently exists in the communication among recruiters and tech professionals. Let me describe you the current scenario in the recruitment world and, please, any feedback will be welcome.

Tech professionals: Wherever I wrote tech professionals I mean any kind of role related with tech companies: software engineers, developers or programmers, manager, product owners, QA, designers, …

Joppy

It all starts…

…taken a beer and asking your friends: How many connection requests do you receive per week from LinkedIn? All three (two developers and a UI/UX designer) answer the same enough to be annoying. Every tech professional want to have his/her CV updated in LinkedIn, it is a great service, but no one agrees with the myriad of emails asking for connections from recruiters that has awesome job offers from awesome companies.

Do you think the job of a recruiter is easy? Well, let me say you are completely wrong. It is not an easy job and often ungrateful. If you think in a more or less important city with many tech companies you can image the competition existing among companies to get tech professional.

Currently there are two main things recruiters can do to arrive to candidates:

  1. Publish offers in some kind of board and wait candidates applies (we all have in mind web sites that crawls and shows tons of job offers)
  2. Make an active search of potential candidates. Recruiters need to use services like LinkedIn, where they can search techies in a given geographical area, that know about X, Y, Z skills and many other options. Once filtered they need to contact each of them where, probably, most of them are not interested in a change or in the position the recruiter is offering.
»
Author's profile picture acanimal

Using async/await in ExpressJS middlewares

If you are not living in a cave for the past year you’ll probably know the async/await keywords are one of the most interesting additions on ES7. It merges the benefits of a sequential syntax with the power of asynchronous programming.

In this post we will cover how we must use correctly async functions as express middleware.

»
Author's profile picture acanimal

Graceful shutdown NodeJS HTTP server when using PM2

So you have created a NodeJS server that receives tons of requests and you are really happy but, as every piece of software, you found a bug or add a new feature to it. It is clear you will need to shutdown your NodeJS process/es and restart again so that the new code takes place. The question is: how can you do that in a graceful way that allows continue serving incoming requests?

»
Author's profile picture acanimal

Using PM2 to manage NodeJS cluster

The cluster module allows us to create worker processes to improve our NodeJS applications performance. This is specially important in web applications, where a master process receives all the requests and load balances them among the worker processes.

But all this power comes with the cost that must be the application who manages all the complexity associated with process managements: what happens if a worker process exists unexpectedly, how exit gracefully the worker processes, what if you need to restart all your workers, etc.

In this post we present PM2 tool. although it is a general process manager, that means it can manage any kind of process like python, ruby, … and not only NodeJS processes, the tool is specially designed to manage NodeJS applications that want to work with the cluster module.

»
Author's profile picture acanimal

Using cluster module with HTTP servers

The cluster module allow us improve performance of our application in multicore CPU systems. This is specially important no matter if working on an APIs or an, i.e. ExpressJS based, web servers, what we desire is to take advantage of all the CPUs on each machine our NodeJS application is running.

The cluster module allow us to load balance the incoming request among a set of worker processes and, because of this, improving the throughput of our application.

In the previous post Understanding the NodeJS cluster module I introduced the cluster module and show some basic usages of it to create worker processes and comunicate them with the master process. In this post we are going to see how to use the cluster module when creating HTTP servers, both using plain HTTP module and with ExpressJS.

»
Author's profile picture acanimal

Understanding the NodeJS cluster module

NodeJS processes runs on a single process, which means it does not take advantage from multi-core systems by default. If you have an 8 core CPU and run a NodeJS program via $ node app.js it will run in a single process, wasting the rest of CPUs.

Hopefully for us NodeJS offers the cluster module that contains a set of functions and properties that help us to create programs that uses all the CPUs. Not a surprise the mechanism the cluster module uses to maximize the CPU usage was via forking processes, similar to the old fork() system call Unix systems.

»
Author's profile picture acanimal

fetch API and Express sessions

TL;DR fetch API is the successor of XHR and although it’s really powerful ( see What is the difference between the Fetch API and XMLHttpRequest?) you should take care of some things, like the fact you are responsible to determine if cookies must be sent to the server.

»
Author's profile picture acanimal

Configuring Atom editor with ESLint and the AirBnB style guide rules

TL;DR This article demonstrate how to integrate the ESLint tool with Atom editor so our source code be automatically checked, showing linting messages in editor. In addition, ESLint will be configured based on the AirBnB code style rules.

»
Author's profile picture acanimal

Introducing Universal Web Applications

TL;DR: This post is the first in a series of articles to talk about Universal (previously known as Isomorphic) Web Applications. The goal of the series is to describe: What an universal web application is? Why are them important? What benefits offers universal web apps? and How to create a boilerplate to start a universal app project. Note, because JavaScript ecosystem is incredible bast and, because we can create an universal web app with almost any combination of framework and libraries, we will use in this series React, Redux and Webpack.

»
Author's profile picture acanimal