5 reasons to host your images on Cloudinary

Image and video management is almost present in our projects. I would like to share my experience around this problem.

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

Node.js REST Frameworks Benchmarks – reloaded (09/08/2019)

The JavaScript and Node.js Blog

I just got the new MacBook Pro 2019 and damm, it is a crazy fast laptop. Thanks to ShareNow Tech for offering such a tools to employees…

A detailed performance review for the Macbook Pro can be found here: https://www.laptopmag.com/reviews/laptops/2019-macbook-pro-15-inch)

Second thing after celebrating and setting the Node.js development environment up, was to measure the I/O performance of the following REST frameworks on their last stable version:

  • Vanilla Node.js
  • Koa
  • Express
  • Fastify
  • 0http (with uWebSockets.js)
  • Restana
  • Polka

NOTE: Network throughput is not the only factor that matter while selecting a backend framework, if you don’t care about low level performance optimisations, is just fine!

Out of the Box tests, single threaded “Hello World” HTTP services

In this tests the services are running using a single process, the Node.js cluster mode is not used for the HTTP Servers.

The tests sources can be found in the restana github repository:

View original post 389 more words

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

A Toy Bug Tracker in JavaScript

This Could Be Better

The JavaScript code below implements a rudimentary bug tracker, or, perhaps more accurately, a task tracker. To see it in action, copy it into an .html file and open that file in a web browser that runs JavaScript.

It’s not actually useful in its current form, of course, as all the users are hardcoded and any tasks added during the session aren’t persisted anywhere. I’d also like to implement parent-child relationships among tasks and add support for generalized attributes. This program is intended mostly as a basis for further work.

View original post

Node.js APIs caching made simple!

The JavaScript and Node.js Blog

In this article we discuss how we can easily implement APIs caching in distributed solutions.
A Node.js implementation is described, in concrete the great http-cache-middleware module:

const middleware = require('http-cache-middleware')()
const service = require('restana')()

service.get('/expensive-route', (req, res) => {
  const data = // heavy CPU and networking tasks...
  res.setHeader('x-cache-timeout', '1 week')

But, what is caching?

Acacheis a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhere. Acache hitoccurs when the requested data can be found in a cache, while acache missoccurs when it cannot. Cache hits are served by reading data from the cache, which is faster than recomputing a result or reading from a slower data store; thus, the more…

View original post 509 more words

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)