How to create a basic rest api?

For example I want to create an api to get the count of patients. Can anyone help me to know the steps how to proceed in code base. I have created one route entry in _rest_routes.inc.php and accessing through postman as shown in image attached below

Help will be appreciated.