From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Built-in pipes (ParseUUIDPipe)

Built-in pipes (ParseUUIDPipe)

The built-in parse UUID pipe is used for parsing the UUIDs, that is, universally unique identifiers from request parameters. Basically, the UUID is a 128-bit number used to uniquely identify information in computer systems. A UUID is typically represented as 32 hexadecimal digits displayed in five groups separated by hyphens in the form of 8, 4, 4, 4 and 12 characters per set. There are various versions of UUIDs and different versions of UUIDs may use different algorithms to generate a unique ID. Some of the common versions include version 1 which is based on the current time and the MAC address for the computer, version 4 which generates random ID and version 5 which is namespace based ID. So the parse UUID pipe ensures that the incoming UUIDs are correctly formatted before they are processed further by the application. Let's check a simple example. Then we have an endpoint that expects a UUID as a parameter. Let me give the dynamic ID inside the get handler. And in the method, I'll…

Contents