Beautiful.
And once we have the connection in place, once we can work with our database.
Usually my next step is to set up the controllers as well as the rods.
So essentially a structure.
Now, of course, normally you cannot set up all the routes right from the start because you have more
as you're developing.
But this is the case where I already know all the routes.
So that way we can right away test everything in a postman.
So the basic set of works and then we don't have to jump around, especially from that point.
We'll just work in the controllers and models.
Now, of course, there's going to be some other stuff as well.
But the point being is that we won't have to jump with every controller pretty much set up the controller
that imported in the routes and hopefully get the gist.
And the setup is going to be following where I want to create a controllers folder and I'm going to
start off controller and it's my preference, the usually years of this type of naming convention.
Similarly, because especially once we start working back in the client, there are going to be bunch
of times over here.
And then it's easier if you can clearly see whether or not you're the author, outer or auth controller.
Again, it's my preference.
So if you don't like that, you don't have to do it, then I want to create following functions and
I'm right away showing the export basically what we'll be exporting and you want to create a function
and then instead of the function, simple return with the rest, not stand and then function name.
And this is again, just so we can quickly test everything in a postman because I'll set up all the
crowds and I want to test whether the structure is in place, if it is.
Then again, we don't have to repeat that step and then we want to create a route.
And then in there, I want to go with Arthur out.
I want to set up the express router.
And if you already figure out how to do that, I'll show you and then we want import functions from
off controller.
Basically, these ones over here and then as far as our roots.
Eventually, in a server, we'll use them in law, so we're going to go abduct years and then we're
looking for API version one.
Essentially, there's just signals that these are going to be API roads and then all the offer outs
are going to go over here to, for example, and then we'll use our author order now in the order.
The rules are going to be followed.
Have a register which is going to be post, then log in and post request and update user will be a batch.
My apologies.
Actually, you'll see your me that it is a patch and then set it up in server, so we'll import author
and set it up in server.
I'll repeat the same steps with jobs as well and then test it out in the postman.
So let's start over here again.
This is in the root.
We just keep that in mind and we're looking for controllers.
That's the phone line.
Or I'm sorry, folder name and line.
We're looking for Auth.
Our controller.
So that's where the log in register, as well as update user functionality is going to be.
And then, like I said, we want to create three functions we want to create register, which is going
to be looking for Iraq and warez and and in here we're going to go with Iraq, not son.
And then let's just send back register, register, use or whatever you want to do, and I'm going to
copy and paste one two.
And there's going to be three of them total.
And then this won't be long in.
And then this one will be logging as well.
Morgan, so let's actually select maybe here both of them, and then let's right update.
Update and user marks, so it's not going to be my function now, going to move this one and then I
do want to that's off, say export and all three of them.
So register log in as well as update user.
So once we have it, I'll actually grab this object and you'll see one second, then we want to go back
to the remote again.
And we're looking for a route running side of the route.
I'm going to go with off Harold James and then we'll set up the router in a second, but before we do
anything, I'm just going to go with import.
Then I want to copy and paste my object, and I'm just going to look for my controllers.
So I was going to be one level up and in the controllers.
I'm specifically looking for auth controller and I must have that gesture.
And with this in place now, I can set up a router and in order to do that, we need to go with import.
We're still looking for express.
So from an express online, we need to go with express dot and router circle around or is equal to express
and that router over here.
Now invoke it.
And now let's set up our roots.
So let me go back to my read me just so I can double check.
So I'm looking for router dot root.
First, I'm registered and logged in update user post post.
And the last one is going to be a patch.
If you want, you can copy and paste brought in my case, I'm going to go with Router Dot Root.
The first one will be register.
This is going to be a post request, and then we want to pass in the register.
Copy and paste and learn.
Looks like I missed.
Here they are.
And by the way, this is an awesome, awesome extension that really helps me out.
Notice this blue squiggly line.
So the extension that I'm using is this one cold spell checker.
That's the one.
Now, even with this extension, I managed to make some dumb typos, meaning some spelling errors and
all that.
So it doesn't save me all the time.
But this was the case where it nicely yelled at me and I was able to fix it.
Just a quick settlement.
And then in here, we want to go with a lot going on, so let's select both of them again and we're
going to be looking for logging online and we want to go with our update user.
Correct?
So let's take these ones and then let's say they'd ears.
Let's say it.
Let's export our order.
So export, export, default and then router and then back in the server.
I guess right after the Connect DB, we can do that or right after middle order, that's really up to
you.
And I think I went in between, I don't know what actually came up with a comment that I on.
I'm going to go here with Debbie and authenticate user, which we're going to set up later.
But like I said, we're going to set it up in between where I'm going to go with routers and here I'm
going to go with import run off router.
And that is coming from in the roots, more specifically around jazz.
Let's save it and then right off 30 home around.
So this will still be our dominant part right after the home run.
I want to go with app years and like I said, the path will be API version one went off and then I want
to pass in my middleware, which will be my router.
So off router over here.
And once I set this one up before we go any further, let's also remember that since these will be a
postrouting, we want to access the JSON that is passed then correct.
We have request.
And how do we do that?
Well, we have a special built in middleware coming from Express.
So back in the server before we go any further, I also want to go above all my roots and I'm going
to use, abduct, use, express and adjacent over here.
I'll invoke it.
And again, I will just make the JSON data available to us in the controllers since we'll have post
requests.
We'll be looking for stuff and that stuff, that JSON data will be passed through us using the express,
not adjacent middleware.
And once we have this in place, we have successfully set up the structure for the auth controller and
routes.