Check out example codes for "postgresql blocked on mac". It will help you in understanding the concepts better.

Code Example 1

$ brew services stop postgresql
$ rm /usr/local/var/postgres/postmaster.pid # adjust path accordingly to your install
$ brew services start postgresql

Learn ReactJs, React Native from akashmittal.com