Category: JavaScript

JavaScript React

Comparing the HashRouter and the BrowserRouter in React applications

We can determine what page the user sees based on the visited URL in a web application with routes. There is more than one way of managing routes with modern single-page applications (SPA). In this article, we look into how hash routing works. We also explain the more modern approach to routing using the history […]

JavaScript NestJS TypeScript

API with NestJS #33. Managing PostgreSQL relationships with Prisma

This entry is part 33 of 48 in the API with NestJS

As applications grow, the number of different entities also increases. A crucial part of learning how to design a database is creating relationships between them. This is because our entities will often relate to each other in some way. Relational databases such as PostgreSQL are an industry standard for quite some time now. Although there […]

JavaScript Node.js SQL

Time intervals with PostgreSQL and TypeORM

In the previous article, we’ve looked into various ways to store the date and time with PostgreSQL and TypeORM. Postgres can also manage intervals. With them, we can store a period of time. Ways to store and display intervals in PostgreSQL There are various ways we can input and view interval values. By default, PostgresSQL represents […]

JavaScript SQL TypeScript

Managing date and time with PostgreSQL and TypeORM

While dealing with data, we often have to handle the date and the time. When doing so, there are quite a few things to consider. In this article, we approach various issues both from the standpoint of PostgreSQL and TypeORM. Ways to store and display date and time in PostgreSQL By default, Postgres represents dates […]

JavaScript NestJS TypeScript

API with NestJS #31. Two-factor authentication

This entry is part 31 of 48 in the API with NestJS

While developing our application, security should be one of our main concerns. One of the ways we can improve it is by implementing a two-factor authentication mechanism. This article goes through its principles and puts them into practice with NestJS and Google Authenticator. Adding two-factor authentication The core idea behind two-factor authentication is to confirm […]

JavaScript React

GraphQL on the client side with Apollo, React, and TypeScript

Recently, we’ve developed a GraphQL API in our NestJS series. NestJS under the hood uses Apollo Server. Although it is compatible with any GraphQL client, the Apollo platform also includes the Apollo Client. If you want to know more about GraphQL and how to develop a backend with it, check out API with NestJS #27. […]

JavaScript NestJS TypeScript

API with NestJS #30. Scalar types in GraphQL

This entry is part 30 of 48 in the API with NestJS

With GraphQL, we model our API as a graph. Within a schema, we have various types of nodes that can relate to each other. While the fields in our query might have sub-fields, at some point, we want to work on concrete data. We refer to the type that describes an individual value as the […]

JavaScript NestJS TypeScript

API with NestJS #29. Real-time updates with GraphQL subscriptions

This entry is part 29 of 48 in the API with NestJS

So far, in this series, we’ve used GraphQL both to fetch and modify data. While this covers many real-life cases, modern applications often include situations in which users need immediate feedback when some event occurs. One of the solutions suggested by the GraphQL team is polling. In this technique, the client periodically requests the API for […]