Limit MySQL subquery results inside a WHERE IN clause, using Laravel’s Eloquent ORM

Limit MySQL subquery results inside a WHERE IN clause, using Laravel’s Eloquent ORM

MySQL sub querying capability is a great tool that can be used to create very powerful and readable queries. In some cases, it can also provide big performance boosts if used correctly. By default, MySQL doesn’t allow us to add a limit clause in our subqueries, when using specific clauses like WHERE IN. Nevertheless, we can easily override this limitation by wrapping our subquery inside another query. In this tutorial, we are going to explain how to limit subquery results…

Read More Read More

Why you should never use sticky sessions

Why you should never use sticky sessions

Sticky sessions grant the ability to route incoming requests to a specific server, based on their session identifier. We usually find them in applications that keep their state in a non-sharable service. An example is keeping state in memory or the server’s hard disk. In this article, we will discuss what sticky sessions are. We will also explain why they are “bad”, and how to design an application so we can fully avoid them.

NodeJS logging, from beginner to expert.

NodeJS logging, from beginner to expert.

In this tutorial, we will discuss how to correctly perform logging on NodeJS. We will start from simple console logs, moving to more advanced features, one step at a time. At the end of this read, you will be able to create a custom logger using the Winston npm library and add transports where logs will be streamed. You will also learn how to add some advanced features, like request tracking and how to implement extra safety precautions that will…

Read More Read More

How to securely store JWT tokens.

How to securely store JWT tokens.

In the last years, JWT tokens are widely used as an authentication and authorization method for web applications. They allow backend developers to authenticate users, without making a single query to the database server or any other type of storage. They are super easy to use and they also use the most common format currently used for data on the Internet, JSON.