WEBVTT

00:03.950 --> 00:05.420
Hey there, everyone that they share.

00:05.420 --> 00:07.220
And let's see how many mistakes we have made.

00:07.220 --> 00:09.710
So it's time to test our route using the postman.

00:09.710 --> 00:14.360
So we're going to test first that if we are able to get a single product or not, let's go into the

00:14.360 --> 00:15.950
postman and see this.

00:15.950 --> 00:18.020
So this is the route for getting all the products.

00:18.020 --> 00:20.290
If I go ahead and send it, it's still working.

00:20.300 --> 00:22.370
That is always a great thing to check out.

00:22.490 --> 00:24.350
Let's go ahead and save this one.

00:24.350 --> 00:26.990
And this one is going to be get one product.

00:27.560 --> 00:29.420
So get one product.

00:29.420 --> 00:30.410
Save this one.

00:31.220 --> 00:31.470
Okay.

00:31.580 --> 00:39.710
So this needs to be slash product and I should be able to access one ID and if I go ahead and send this

00:39.710 --> 00:45.410
one into the route and I send this one, this actually gets me a one product.

00:46.070 --> 00:47.480
Are we getting just one product?

00:47.480 --> 00:49.040
Yep, we are getting one product.

00:49.040 --> 00:50.210
Let's verify that.

00:50.240 --> 00:51.560
Yep, this is one product.

00:51.650 --> 00:52.520
So this is good.

00:52.520 --> 00:53.540
So one testing is good.

00:53.540 --> 00:55.280
At least we are getting one product.

00:55.310 --> 01:01.880
Now the next route is we have already tested out the admin add testing it again doesn't really going

01:01.880 --> 01:04.460
to harm so go ahead and test it out on your own.

01:04.550 --> 01:09.230
Now this one is admin slash products so admin can get all the products.

01:09.230 --> 01:11.600
Let's go ahead and test this one out already.

01:12.410 --> 01:18.320
This doesn't need to be get all the product so this one is slash products and let's go ahead and make

01:18.320 --> 01:19.490
a copy of this one.

01:20.390 --> 01:27.110
So this one is actually admin, get all get admin all products.

01:29.060 --> 01:29.750
There we go.

01:29.750 --> 01:30.740
Save that.

01:31.400 --> 01:37.160
And this one is if we go ahead and say the route is slash admin slash product.

01:37.160 --> 01:39.080
So he should be able to get all the products.

01:39.290 --> 01:43.940
So slash admin slash products, let's go ahead and send this.

01:43.940 --> 01:50.450
So this is also same we are receiving all the products at so that we go one, two, so we have two.

01:50.480 --> 01:52.160
So this is also working fine.

01:53.600 --> 01:54.950
Now what else we got.

01:54.950 --> 01:57.590
The next up is admin is getting all the product.

01:57.590 --> 02:02.540
Now admin is able to update the product slash admin slash product slash ID.

02:02.930 --> 02:03.890
That's interesting.

02:04.010 --> 02:07.280
Let's go ahead and make a copy of this one.

02:07.370 --> 02:17.750
So admin update, update one product product.

02:17.750 --> 02:18.410
There we go.

02:18.620 --> 02:20.030
Save this one.

02:20.030 --> 02:23.810
And this one obviously is going to be a put request.

02:23.810 --> 02:25.160
So save that first.

02:25.460 --> 02:28.890
And now I want to update the product, which is a classic, right?

02:28.910 --> 02:29.690
Code t shirt.

02:29.690 --> 02:30.530
Copy that.

02:30.620 --> 02:34.850
And this one is going to be slash admin, slash product, slash the ID.

02:35.090 --> 02:40.370
And again, you can send as much data to be updated as much as you want.

02:40.460 --> 02:45.500
But the way how we have written it is we are not checking individually that what you are sending me

02:45.500 --> 02:46.250
or not.

02:46.280 --> 02:53.200
We are updating it entirely based on we are only checking and doing the things optionally for the files

02:53.210 --> 02:53.570
itself.

02:53.570 --> 02:56.450
So if the request file exists, then we are going to check all of that.

02:56.450 --> 03:01.520
Otherwise we'll be updating whatever all you are going to send me inside the body itself.

03:01.520 --> 03:05.330
So make sure you are cautiously sending me all the data that you got up here.

03:05.540 --> 03:09.890
So let's go ahead and see when we are actually adding the products to admin add product.

03:09.920 --> 03:11.930
We should be rather copying this one.

03:11.930 --> 03:13.940
So I'm going to go ahead and remove this one.

03:13.940 --> 03:19.400
So this should be deleted because I want to grab all of this data here as well.

03:19.400 --> 03:24.260
So I'm going to go ahead and say this is my admin all route and I'm going to go ahead.

03:25.650 --> 03:29.780
And this can be saved and let's remove this, remove this and remove this.

03:29.790 --> 03:32.370
So I am interested in admin add product.

03:32.370 --> 03:39.870
Let's go ahead and make a copy of this one, save this one admin, update a product, save that.

03:39.870 --> 03:43.290
And this time this is going to be a put request.

03:43.290 --> 03:49.020
And I really hate that, that it didn't bring any of the parameters inside the body.

03:49.020 --> 03:50.640
Know it bring that it bring that.

03:50.790 --> 03:51.480
My bad.

03:51.480 --> 03:57.420
So we won't be sending the photos, we won't be sending the brand and we'll be just updating the pricing.

03:57.420 --> 04:01.800
So let's go ahead and change this one instead of 599, probably things are getting expensive.

04:01.800 --> 04:03.450
So 699 is the stuff.

04:03.450 --> 04:05.160
So we are just updating the price.

04:05.640 --> 04:11.610
So now another option in front of us or another problem in front of us is send that ID properly.

04:11.970 --> 04:19.860
So here we are receiving all the response in admin, get all products and let's also get all products

04:19.860 --> 04:24.360
like this and let's go ahead and copy this classic write code t shirt.

04:24.360 --> 04:33.180
ID come up here and we'll say admin slash product slash ID and we are sending all of this information

04:33.180 --> 04:33.870
except the photo.

04:33.870 --> 04:35.700
I don't want to check the photo as of now.

04:35.700 --> 04:43.020
Let's see if the pricing gets to 699, send that and it says, hey, there is an error which says parameter

04:43.770 --> 04:46.950
filter code to find must be an object.

04:47.860 --> 04:48.110
Okay.

04:48.220 --> 04:50.110
So this looks like that.

04:50.680 --> 04:53.890
Sometimes the copying and pasting actually creates a problem.

04:53.890 --> 04:55.300
So let me send that again.

04:55.990 --> 04:58.210
And this is creating an issue.

04:58.920 --> 04:59.160
Okay.

04:59.230 --> 05:00.160
So find it out.

05:00.160 --> 05:01.640
And again, it was really simple.

05:01.660 --> 05:06.040
Here we are actually while updating one product we actually just wrote Find.

05:06.040 --> 05:11.260
It should rather be fine by it because we are finding a product by an ID so we can go ahead and say

05:11.260 --> 05:12.040
fine by ID.

05:12.040 --> 05:15.670
And I guess same thing needs to be updated into the delete file as well.

05:15.670 --> 05:18.220
So let's go ahead and work on with that part also.

05:18.550 --> 05:19.690
So really classic bug.

05:19.690 --> 05:24.340
And again, you can only find these bugs by having a test of that.

05:24.340 --> 05:27.460
So hopefully this is all being saved and this looks all good.

05:27.460 --> 05:29.230
Let's go ahead and try it one more time.

05:29.440 --> 05:32.380
So this time let's go ahead and try the update route one more time.

05:32.380 --> 05:33.400
We are updating the price.

05:33.400 --> 05:40.420
Let's go ahead and send this one and it says assignment to a constant variable and looks like we are

05:40.420 --> 05:41.850
not able to update that.

05:41.860 --> 05:44.320
Let's go ahead and see that again one more time.

05:44.620 --> 05:49.570
So this one was pretty classic because we are actually sending and updating this entire T of the product.

05:49.570 --> 05:50.740
So shouldn't be a big deal.

05:50.740 --> 05:55.270
Now let's go ahead and move on to this one where we are admin updates.

05:55.270 --> 05:57.460
This shouldn't be a const, this should be a lit.

05:57.460 --> 05:59.560
Again, really a very basic error.

05:59.560 --> 06:01.480
But again, we need to test out all these things.

06:01.480 --> 06:02.680
You need to see all these errors.

06:02.680 --> 06:05.080
Let's go ahead and send this one more time and voila.

06:05.110 --> 06:07.930
Finally, we have updated this after a couple of bugs.

06:08.110 --> 06:11.290
Okay, so this is updated, but I would love to check it one more time up here.

06:11.290 --> 06:13.030
So let's go ahead and refresh this.

06:13.030 --> 06:15.490
And we have the t shirt of 699.

06:15.700 --> 06:16.410
That's fine.

06:16.420 --> 06:19.870
Now I want to delete this t shirt, which is the pro coder.

06:19.870 --> 06:21.670
Don't want to, but I have to.

06:21.700 --> 06:22.660
So there we go.

06:22.690 --> 06:28.090
Let's go up here and let's make a copy of this one because this seems to be fine.

06:28.090 --> 06:30.880
And admin delete.

06:31.030 --> 06:32.890
Is it spelled delete like that.

06:32.890 --> 06:33.330
Nope.

06:34.600 --> 06:36.550
Delete looks same.

06:36.580 --> 06:36.910
Okay.

06:36.910 --> 06:38.410
So let's go ahead and delete the one.

06:38.410 --> 06:41.020
This is going to be a simple delete request.

06:41.020 --> 06:42.190
So delete.

06:42.700 --> 06:42.890
Okay.

06:43.000 --> 06:45.760
We don't need to send anything inside the body or anything.

06:45.760 --> 06:50.170
All we got to do is let's go ahead and remove all of this because we don't need to send anything inside

06:50.170 --> 06:51.910
the body we shouldn't be sending.

06:52.210 --> 06:54.580
Let's delete this and sending the product.

06:54.580 --> 06:57.820
We are just removing the same t shirt, which is the previous one.

06:57.820 --> 06:59.590
It's a classic write code is getting deleted.

06:59.590 --> 07:03.010
Let's go ahead and send this one and it says, hey, product was deleted.

07:03.010 --> 07:04.150
That's fantastic.

07:04.780 --> 07:05.800
And there we go.

07:06.390 --> 07:07.630
Okay, so this is all good.

07:07.630 --> 07:11.350
Now we have just one product in the database, so I would love to add another product.

07:11.350 --> 07:15.730
Let's go ahead and do that just right now so that we don't have to bother too much.

07:15.730 --> 07:17.440
So admin add product.

07:17.470 --> 07:19.420
So admin is going to add the product.

07:19.420 --> 07:21.130
We are going to go ahead and change this one.

07:21.130 --> 07:22.480
So it is a classic.

07:22.690 --> 07:24.040
I write code t shirt.

07:24.040 --> 07:26.050
Let's go ahead and see what is the name of it.

07:26.050 --> 07:26.320
Yeah.

07:26.320 --> 07:26.710
Classic.

07:26.710 --> 07:27.910
I write code 599.

07:27.910 --> 07:28.510
All good.

07:28.510 --> 07:30.400
Let's select the files for it.

07:30.760 --> 07:34.840
So this one is coder and coder t.

07:34.870 --> 07:38.920
Let's go ahead and select all of that, open that so that we have these t shirts.

07:38.920 --> 07:42.790
And again this time we are going to change the price to 799.

07:42.790 --> 07:45.160
Again, pricing is getting increased every day.

07:45.850 --> 07:46.100
Okay.

07:46.120 --> 07:49.390
So let's go ahead and send this one and see if the previous routes are working.

07:49.390 --> 07:52.270
Nice testing for that and we'll have some data to work on with.

07:52.270 --> 07:54.250
That's the most important thing I want to have.

07:54.880 --> 07:55.180
Okay.

07:55.180 --> 07:55.780
Come on.

07:55.780 --> 07:57.340
A little bit faster than that.

07:58.860 --> 07:59.340
Okay.

07:59.430 --> 08:00.690
This is getting too much.

08:01.290 --> 08:02.790
Probably we broke something.

08:03.600 --> 08:05.010
No, we didn't broke anything.

08:06.390 --> 08:06.990
That looks good.

08:06.990 --> 08:09.720
Let's go ahead and check into the database if everything is working fine.

08:09.720 --> 08:14.460
So we have two T-shirts, a classic pro coder T-shirt, as well as a classic Redcoat T-shirt.

08:14.490 --> 08:19.450
Now, the reason for that is because obviously I want to add more fields and reviews and all of that.

08:19.470 --> 08:21.240
We'll be doing that in the next video.
