Category: TypeScript

NestJS

API with NestJS #61. Dealing with circular dependencies

This entry is part 61 of 187 in the API with NestJS

We need to watch out for quite a few pitfalls when designing our architecture. One of them is the possibility of circular dependencies. In this article, we go through this concept in the context of Node.js modules and NestJS services. Circular dependencies in Node.js modules A circular dependency between Node.js modules happens when two files […]

NestJS

API with NestJS #60. The OpenAPI specification and Swagger

This entry is part 60 of 187 in the API with NestJS

Across this series, we emphasize code readability and maintainability. In part #52 of this course, we’ve gone through generating documentation with Compodoc and JSDoc. This time we look into the OpenAPI specification and the Swagger tool. You can check out an interactive demo prepared by the Swagger team. Introducing OpenAPI and Swagger With OpenAPI and […]

JavaScript NestJS

API with NestJS #58. Using ETag to implement cache and save bandwidth

This entry is part 58 of 187 in the API with NestJS

We’ve introduced various ways of caching files on the server throughout this series. This article teaches how to help the browser perform caching on the client side. We use the entity tag (ETag) response header to do that. Imagine having a endpoint that responds with an image. The browser calls it every time we […]

JavaScript NestJS TypeScript

API with NestJS #56. Authorization with roles and claims

This entry is part 56 of 187 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 187 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 […]