Category: JavaScript

JavaScript NestJS TypeScript

API with NestJS #56. Authorization with roles and claims

This entry is part 56 of 56 in the API with NestJS

So far, in this series, we’ve implemented authentication. By doing that, we can confirm that the users are who they claim to be. In this series, we explain how to implement authentication with JWT tokens or with server-side sessions. We also add two-factor authentication. While authorization might at first glance seem similar to authentication, it serves […]

JavaScript NestJS SQL TypeScript

API with NestJS #53. Implementing soft deletes with PostgreSQL and TypeORM

This entry is part 53 of 56 in the API with NestJS

In this series, we’ve implemented deleting functionalities for various entities. So far, it has always meant removing records permanently from our database. Instead, we can perform soft deletes. When we delete a record using a soft delete, we only mark it as deleted. You can find the code from this series in this repository. Soft […]

JavaScript MongoDB NestJS TypeScript

API with NestJS #48. Definining indexes with MongoDB and Mongoose

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

The bigger our database is, the more demanding our queries become in terms of computing power. A common way of tackling this problem is by creating indexes. In this article, we explore this concept and create indexes with MongoDB and Mongoose. When performing a MongoDB query, the database must scan every document in a given […]

JavaScript MongoDB NestJS TypeScript

API with NestJS #47. Implementing pagination with MongoDB and Mongoose

This entry is part 47 of 56 in the API with NestJS

When our application grows, so does the database. At some point, we might return a lot of data from our endpoints. It might prove to be too much for our frontend application to process, for example. Therefore, we might need to paginate our records by returning just a portion of them. This article explores different ways […]