I am trying to find a way to connect DB from postman and how it can be done?
you cannot connect postman to an external api :
Postman allows only the below list of nodejs libraries in the test script and pre request section:
https://learning.postman.com/docs/writing-scripts/script-references/postman-sandbox-api-reference/#using-external-libraries
you can use native js libraries if it has a cdn equalent please see the discussion here:
https://community.postman.com/t/adding-external-libraries-to-postman/1971/8
So to answer your question , the best way will be to write a nodejs program to conect to postgresSQL and expose it by wrapping it with express API . SO that postman can access the result.
ALso see if the below example collection helps:
https://documenter.getpostman.com/view/5922408/RznJmGfn#ed6af38c-dd01-4a9c-9e40-d1071276d6a0
2.1m questions
2.1m answers
63 comments
56.6k users