This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello everyone, today I'll demonstrate how to troubleshoot the issue where the cookie is | |
being successfully set in development environments but not in production. | |
Suppose that in you server you are sending the cookie in the res like bellow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Explanation file: db.js | |
This code imports the mongoose library which allows to connect to a MongoDB database. | |
There are two URIs defined to connect to two different databases: MONGO_URI and MOBILE_URI. | |
Each URI contains connection information to a remote MongoDB database, including user credentials. | |
The connectDBs function uses the mongoose.createConnection method to create connections to these two | |
databases using the respective URIs. The useUnifiedTopology and useNewUrlParser options are set to enable the new | |
unified topology policy and use MongoDB's new URL parser, respectively. | |
The function returns an object that contains the connections to these two databases as qrCodeDb and userDB properties. |