'Get distance between two nearest latitude and longitude

I want to find a nearest distance between two point. I am creating a ordering based application in which I need to find a nearest distance of customer and provider within a certain range (3km) I am using a postgres as a database and a sequelize as a orm. I don't want want to use Haversine formula in my code is there any way that can I use it



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source