Category: TypeScript

JavaScript NestJS TypeScript

API with NestJS #3. Authenticating users with bcrypt, Passport, JWT, and cookies

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

Authentication is a crucial part of almost every web application. There are many ways to approach it, and we’ve handled it manually in our TypeScript Express series. This time we look into the passport, which is the most popular Node.js authentication library. We also register users and make their passwords secure by hashing. You can find all […]

Express JavaScript TypeScript

TypeScript Express tutorial #14. Code optimization with Mongoose Lean Queries

This entry is part 14 of 15 in the TypeScript Express tutorial

Mongoose does quite a bit of heavy-lifting for us. It is immensely useful, but not necessary in every case. In this article, we explore the Mongoose documents more and learn what we can achieve by giving up their benefits. Mongoose Document In the second part of this series, we’ve created our first models. They allow […]

JavaScript TypeScript Uncategorized

More advanced types with TypeScript generics

Previously, we’ve discussed the basics of TypeScript Generics. This time, we take them to a higher level. In this article, we learn about index types. To do so, we also explore union types, the keyof keyword, and string literal types. Today we also learn mapped types and use them with conditional types. Index types Generics are very useful in many situations. […]