DEV Community

Discussion on: #Help with passport and postgresql

Collapse
 
lucretius profile image
Robert Lippens

If you store your user in postgresql, you could interact with your database with raw SQL queries or use an ORM to manage the interaction for you. I'd suggest putting all your database access behind a common interface so that if you swap to using a different database later on you don't have issues.

Basically, just make a db module with an exported function called "findUser" and in there you can implement the method by retrieving the user from the database using your ORM/raw SQL. Then import this db module where you want to call your passport auth and then call the function "findUser" that you have written.