So what is the difference between put and patch?
Well, here's a good analogy.
Recently I went onto Amazon and I found a really nice looking bicycle.
And because I really wanted to poison my lungs by exercising around London, I clicked on the Buy Now
button.
So there I was, super happy, super excited for my bicycle to arrive.
And then on the day of arrival, I opened up that box and my bicycle was really messed up.
The whole front wheel was broken.
So I'm not really sure what happened at the Amazon warehouse, but I got in touch with them and I wanted
to try and figure out how we can solve this problem.
So there were two ways that they could fix this problem.
Option one was they send me an entire new bike.
So this is the equivalent of put. You're updating your database by sending an entire entry to replace
the previous one.
Now, the other option Amazon offered was for them to simply send me a new tire.
That was the only thing that was broken,
the rest of the bike was fine.
And in order to save the world from carbon emissions, shipping a wheel is much better than shipping
an entire bicycle.
And this is the same as Patch.
So when you're sending a patch request to the server, you're only sending the piece of data that needs
to be updated. Instead of the entire entry that will be replaced,
you're simply just updating the thing that needs to be updated.
So when we see this in practice, I want you to think back to this bicycle analogy and maybe it'll help you try
and understand the difference between these two words.