WEBVTT

00:00.640 --> 00:04.400
So now we have this routes. It's entirely generated with a

00:04.900 --> 00:08.400
few minor changes by the GitHub copilot. So now we can check if it actually

00:11.840 --> 00:15.160
So we have not found because we didn't

00:15.660 --> 00:19.320
actually add the router in our index file because even though our

00:19.820 --> 00:23.080
models and routes are created, but we also need to hook

00:23.580 --> 00:26.800
it up in the index file itself. In order to do that we

00:27.300 --> 00:30.540
would need to add API companies.

00:30.860 --> 00:35.900
Right? And then we will do the same with the

00:35.980 --> 00:39.420
shareholders, right? It will even suggest us from where we can take this

00:40.220 --> 00:45.420
routes. But we do not want to require it like that. We will just ask

00:45.920 --> 00:51.100
it to rewrite it

00:51.600 --> 00:53.820
using import instead of require.

00:55.780 --> 00:59.220
And let's see how it would be working. So you see it's moving

00:59.720 --> 01:03.180
the require, removing it and moving to the top as

01:03.680 --> 01:06.900
an import. So we can do that. We do not have actually shareholders

01:07.400 --> 01:11.460
router yet. We will add it a bit later. But our main middleware

01:11.960 --> 01:16.140
for routers is added right now. And the company routes

01:16.640 --> 01:20.140
is also working. So let's comment it the shareholders

01:20.640 --> 01:23.940
router for now before we create it and just to make it work.

01:24.440 --> 01:27.780
And then let's see if the application is actually working.

01:28.340 --> 01:32.140
Okay. We still cannot retrieve it because we need to change the base URL back

01:32.640 --> 01:36.460
to the slash because we already defined the full path and let's see if

01:36.960 --> 01:40.580
that works. So we have our empty companies

01:40.660 --> 01:44.500
available here because we didn't create anything. So let's try to create

01:44.580 --> 01:47.700
one. We have a.

01:47.860 --> 01:51.580
Let's say company one with no shareholders,

01:52.080 --> 01:56.140
no shares. You don't need to send all of this default data because it's automatically

01:56.640 --> 02:00.620
would be added. And let's try to create one. Okay,

02:01.120 --> 02:04.860
so we created the companies. There is no shareholders, no shares, no capitalization, only name.

02:05.180 --> 02:08.380
And then we try to run the get to see if it's added.

02:08.620 --> 02:12.300
So now it's actually added. We have it saved in MongoDB,

02:14.380 --> 02:18.940
cannot delete because we also need to update

02:19.440 --> 02:23.110
the URLs with the parameters because the default

02:23.610 --> 02:26.910
one is slash. So let's see if we

02:27.410 --> 02:30.630
can delete it now. Yeah, successfully deleted. And now if you try to get it,

02:31.130 --> 02:34.670
we have zero. Let's create one again and

02:35.170 --> 02:37.309
then let's try to update it with some.

02:40.430 --> 02:44.710
With some data. Let's say capitalization shares would

02:45.210 --> 02:47.400
be 10,000 and 1,000. So we updated,

02:48.680 --> 02:52.480
it's updated and for now it returns the default company. But if

02:52.980 --> 02:56.760
we get it, it would be updated. So everything works.

02:57.260 --> 03:00.320
We don't need to do anything extra for the companies. Everything works.

03:00.820 --> 03:04.080
We don't need to do anything extra for the companies and then let's go and

03:04.580 --> 03:09.080
create the shareholder. Actually, I was thinking about creating

03:09.580 --> 03:13.200
the shareholders route separately and then just add

03:13.700 --> 03:16.230
the file into the code templates.

03:16.790 --> 03:18.230
See you in the next section.
