A developer creates a new microservice within a monorepo for handling reservations. They use the Nest CLI to generate the service, configure Mongoose models, implement abstract repository patterns, and perform CRUD operations, ultimately testing the endpoints using Postman to confirm successful creation, retrieval, updating, and deletion of data.
Length 20:22
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #nestjs #microservice #monorepo #mongodb #mongoose #crud #api #typescript #backend #development
0:00 Okay, so we're ready to test out our newly 0:02 created abstract repository. 0:04 And to do that, we're gonna go ahead and create our first microservice inside 0:08 of our monorepo, the service responsible for actually 0:12 taking reservations from our users when they want to 0:16 book a stay somewhere. So in order to generate this in the 0:19 terminal, I'm 0:19 going to use the Nest CLI and run nest g, for generate, 0:24 app, and we'll call this microservice 0:27 reservations. 0:28 So we can see that we have a newly created apps 0:31 directory here with a default directory with our 0:35 existing source folder from before, 0:38 and the important reservations folder, which has its own 0:42 source directory and set of default files, as well 0:46 as its dedicated TS config that will extend our root 0:49 TS config. So if we also go ahead and look at the Nest CLI... 0:53 So we can see we've added these two new applications into our 0:56 nestcli.json. And so we're not actually going to 1:00 keep this sleeper directory here, the default one out of the box. 1:04 So we can actually go ahead and remove this, and let's go ahead 1:07 and change 1:08 our root here to instead of apps sleeper, we'll change it 1:11 to apps reservations, which will be our default 1:15 project. And also go ahead and change here the TS 1:18 config path and make sure we pass in 1:21 apps/reservations. And finally, we have the source 1:25 root property here, which we can see points at the default 1:29 project 1:29 in a monorepo. So as I said before, our default project, we will 1:33 just use the reservations, so swap that out here. 1:36 And then finally, we can go back and actually delete the sleeper 1:40 directory altogether. And so now we just have our 1:44 apps reservations directory. Should be able to go back to our terminal
The rest of the transcript is for members.
Sign in