When we order food at a restaurant, the chefs don’t wait till one dish is completely ready before starting on the next one.
They take in the orders from the wait staff and complete them with priorities in mind.
They’ll finish appetizers first and they may also be dealing with meals ordered by other customers at the same time
The restaurant could not function properly if dishes could only be processed one at a time and it would be very awkward for our guests if dishes were delivered one at a time in the same order that they were placed!
Whoever ordered first would end up with cold food! :(
Instead, orders are handled asynchronously, this means that appetizers can be delivered when they’re ready, potentially a couple at a time
Make sure to start json-server from the right place!
If you run json-server --watch db.json, then your terminal will need to be in the same working directory as the db.json file.
Killing a zombie server
Diagnosis
Some error occurred Error: listen EADDRINUSE: address already in use 127.0.0.1:3000
Cure
kill $(lsof -t -i:3000)
Regimen
alias k3000="kill $(lsof -t -i:3000)"
I’ve created an alias for this fix, k3000, so I can just type k3000 in my terminal to run this command. To add your own alias, you’ll want to put this code in your terminal profile: ~/.zshrc, ~/.bash_profile, or ~/.profile