Hey, did everyone share?
And in this video, we are going to work on the one route that is remaining for this project, which
is slash admin slash order ID since this is a red one means we have to just delete this one.
In fact, I would encourage you to pause this video right here, go further beyond me and just create
this route.
It should be really super simple.
After that, we are going to be pushing the things on to the Git repository as well.
This is not at all by any means a full fledged git tutorial.
I do have a separate course on that, but still I would love to keep that onto a separate some remote
repository or something.
We won't be going into too much of detail, but still, at least we'll walk you through some of the
basics of it.
Not too much basics even.
Let's go ahead and work on with that.
So slash admin, slash order, slash ID.
That means it will come to me in the params.
Let's go ahead and work with that.
I would simply go ahead and copy this one, shrink this one and expand this one.
And we are going to go ahead and simply say admin, delete order.
Or delete one order in this case.
So this is all good.
We need to find the order.
We are going to go ahead and find the requested params dot id.
So this is all good.
We don't want to pass on anything inside the body.
Delete means just all delete like old one.
And we also don't need to update any of the stock.
In the case of deletion, the order is not affecting anything in the in that case and instead of the
order dot save, we have to just simply go ahead and say order dot remove.
And in this case we are going to just pass on order success as true and that's pretty much it told you
now things get repetitive.
Even if you work in any other project or something, you're going to find that there is too much similarity
of working with the things.
So that's pretty much it.
Let's go ahead and send this admin delete order into the root itself.
So we're going to go ahead and this is an admin route, so slash order and did we actually put up this?
This one was orders and another controller is admin update order.
So we haven't actually worked on that part also.
So let's go ahead and get a copy of this one.
So let's go ahead and say we need a duplicate of this one.
So this one was admin slash order and this one was a slash colon ID, so somebody gives me an ID, this
one is a put request because we are updating this stuff and we need to bring in the root which is admin,
get all orders and then we have admin update the order as well as admin delete the order.
Let's use a comma for housekeeping purposes.
So first let's handle the update.
So this is all good.
Let's go ahead and make a copy.
And similarly we have to make a copy of this one.
Let's remove it like that.
And this time this is a delete request.
If delete request comes in, he should be logged in, he should be admin and this time he should be
able to delete order.
What was that.
Admin.
Delete order.
Copy that and paste that.
So there we go.
In theory, at least all of our routes and everything are complete so we can go ahead and save this
one and hopefully things are all okay.
Yeah, it looks all okay, at least as of now.
Let's go ahead and close all of these.
So let's go ahead and close all of this.
Let's actually push all of these things into the git repository.
So how to do that?
Although I highly recommend to take a dedicated git course in case you really want to understand what's
happening behind the scene.
You don't want to stick around with just firing three or four commands of Git without understanding
what's actually happening.
So let's go ahead and create a new, new file in the route of the project itself.
We're going to call it as DOT, get ignore, make sure you call it exactly as git, ignore dot get ignored.
It is really important in this file you can place all the folders that you don't want to push onto this
any repository or servers or anywhere in the production.
So first one is dot and V.
We definitely want don't want this file to go up.
The second one is the node modules, folder node underscore modules and the folder.
So slash at the end of it.
So these are two folders that I don't want to push anywhere.
That's what I'm going to write.
If you have any more files or folder or some testing, just go ahead and add them up here.
It's automatically going to be not pushing them.
The reason why we don't push the node module folder is because it is recreate able.
As soon as you see this package or JSON, you can just run NPM install and it's going to automatically
bring this node module folder.
That's pretty much easy, as simple as it can be.
Let's go ahead and kill the process of this one and let's go ahead and initialize a git repository here.
So we're going to go ahead and say, get in it.
This is going to initialize a git a git folder here.
Now this folder is a little bit tricky that you are not going to see that, but trust me, it is there.
I can show you that by showing you the hidden files up here.
Let me expand this a little bit up here.
So if I go ahead and say, ls dash l a, it's going to give me the files.
So if I can scroll a little bit notice here there is a dot git folder here.
Now this folder is not visible in windows just like that.
You have to unlock the show me hidden folders or something like that.
And Linux and Mac, I can just go ahead and run this command which is ls dash le which shows me the
hidden folder.
Now git is initialized here.
Now we need to add all the folders up here.
So we're going to go ahead and say get add.
Now you can name your file one by one like JS, but since there is a lot that I have to initialize in
the repository, I can just say dot, that means, hey, whatever is there in the current folder where
I am right now, just add everything there.
So we're going to go ahead and add this all and this is this is technically added.
As for monitoring, this has not been pushed into a git a project itself.
So we're going to go ahead and do that now.
So we're going to go ahead and say get commit, make a comment and make sure you provide a dash and
then a message.
If you are not going to provide that, it's going to open up your default editor, which can be notepad
or something else.
So we're going to go ahead and say first push for D store D Store project.
And of course, after this, there are going to be many more comments up here because I'm pretty sure
there are lots of errors in this project, and eventually that's how the project actually evolves.
So this is all being done and now things are actually being tracked and everything is all okay.
So this is all good.
In case you are having a GitHub account or GitLab account or whatever there is, you may find a remote
repository there and instructions that how we can push this existing repository onto a remote repository
somewhere like GitLab or GitHub, you can just do follow those commands as well, but that's pretty
much it from our side.
Let's go ahead and catch up in the next video.