Redirect all requests from HTTP to HTTPS un Node.js and Express

The first step will be to create a method to guess if the HTTP request comes from HTTP or HTTPS (secure or not secure). In some context like AWS or Heroku you will have to ask by the header x-forwarded-proto instead of req.secure. Have in mind that req.secure will return always false if there is … Continue reading Redirect all requests from HTTP to HTTPS un Node.js and Express

Http auth basic in Node js and Express

Let's build a small site in Node.js using Express that will have one protected page Http auth basic prompt dialog We are going to use express generator to generate some scaffolding. If you didn't install it just type this command to install it globally but if you already know all this stuff you might skip … Continue reading Http auth basic in Node js and Express

Better Queue in Node JS

Introduction A good practice in software development is to delegate as much heavy work as possible to background jobs to avoid blocking the main execution of your application that can be a web app, mobile app or desktop. Send email notifications it’s the typical scenario where you should execute it in background. More scenarios Image … Continue reading Better Queue in Node JS

Full-text search in Node JS (search related data)

If you are building a website, e-commerce, a blog, etc., you will need a full-text search to find related content like Google does for every web page. This is an already known problem so probably you don't want to implement your own solution. One option is to use the flexsearch module for Node js. So … Continue reading Full-text search in Node JS (search related data)