A developer builds an authentication microservice using NestJS, creating modules, controllers, and services for user management. The process includes defining schemas, implementing data validation, dockerizing the application, and testing API endpoints with Postman to ensure successful user creation and validation.
Length 12:31
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #nestjs #authentication #microservice #docker #typescript #mongodb #postman #api #coding #development
0:00 Okay, so we're ready to add our new 0:02 authentication microservice. 0:04 We're just gonna deal with all authentication and identity 0:08 access management related functionality in our app. 0:11 Let's go ahead and create this new app by going back to the 0:15 CLI, and we'll use the Nest CLI and run Nest 0:19 generate app auth. So this is gonna go 0:23 ahead with this normal process of creating a new application 0:27 by creating a new app's auth directory, updating our TS 0:30 config and our package.json as well as the 0:33 nestcli.json. You can of course go to the Nest CLI 0:36 and see the 0:37 new auth application that was added. 0:39 So our first step in implementing authentication in our 0:43 auth microservice is gonna be to actually implement the idea of 0:47 users. So we want this microservice to be able to 0:50 create 0:51 new users and authenticate or log in against those 0:55 users and obtain a JSON web token. So the user will provide 0:59 their credentials. We'll give them back 1:00 that token to authenticate them, 1:02 which is a very common authentication mechanism. 1:06 And we can make use of this authentication mechanism in all of our different 1:10 microservices that will implement authentication. 1:13 So let's go ahead and get started back in our terminal here. 1:16 We're gonna generate 1:17 a module called users, and then it should ask us 1:21 which project we want to use. In this case, we can say auth. 1:25 So we're also gonna use the CLI to generate a controller here so that we 1:29 can actually create new users over HTTP. 1:33 And we'll select the auth project here. 1:36 You can see it create the new users controller and update the users 1:39 module. So now if we go back to our auth module, 1:43 we can see we're 1:43 importing the users module, which is inside this new users 1:47 directory. And the users module here has the user
The rest of the transcript is for members.
Sign in