Category: NestJS

JavaScript NestJS TypeScript

API with NestJS #17. Offset and keyset pagination with PostgreSQL and TypeORM

This entry is part 17 of 121 in the API with NestJS

As our database grows, so do the results of our queries. Returning a lot of data in our API might not be the best approach performance-wise. Dividing our content into multiple pages and solutions like infinite scrolling have been around for quite some time. In this article, we explore ways of implementing pagination and point […]

JavaScript NestJS SQL TypeScript

API with NestJS #16. Using the array data type with PostgreSQL and TypeORM

This entry is part 16 of 121 in the API with NestJS

Storing arrays is not an obvious thing in the world of SQL databases. Solutions such as MySQL, MariaDB, or Microsoft SQL Server don’t have a straightforward column type for arrays. This article explores how the array data type works in PostgreSQL both through SQL queries and through TypeORM. By learning how to operate on arrays […]

JavaScript NestJS TypeScript

API with NestJS #14. Improving performance of our Postgres database with indexes

This entry is part 14 of 121 in the API with NestJS

As our system grows, certain queries on our database might fail us in terms of performance. One of the popular ways of dealing with this issue are indexes. This article explores how we can use them both through TypeORM and writing our own Postgres queries. Introduction to indexes When we store information on a disk, […]

JavaScript NestJS TypeScript

API with NestJS #12. Introduction to Elasticsearch

This entry is part 12 of 121 in the API with NestJS

We can find some searching functionalities in a lot of web applications. While we might be fine when iterating through a small data set, the performance for more extensive databases can become an issue. Relational databases might prove to be relatively slow when searching through a lot of data. A solution to the above problem […]

Express JavaScript NestJS Testing TypeScript

API with NestJS #9. Testing services and controllers with integration tests

This entry is part 9 of 121 in the API with NestJS

In the previous part of this series, we’ve focused on unit tests. This time, we look into integration tests. In this article, we explain their principles and how they differ from unit tests. We write a few of them using Jest to test our services. We also look into the SuperTest library to test our controllers. […]

JavaScript NestJS TypeScript

API with NestJS #8. Writing unit tests

This entry is part 8 of 121 in the API with NestJS

Testing our application can increase our confidence when it comes to creating a fully-functional API. In this article, we look into how we can test our application by writing unit tests. We do so by using some of the utilities built into NestJS, as well as the Jest library. If you would like to get […]