What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-16 19:33:02
serverless and connections mongodb atlas
const mongoose = require('mongoose'); mongoose.Promise = global.Promise; let isConnected; module.exports = connectToDatabase = () => { if (isConnected) { console.log('=> using existing database connection'); return Promise.resolve(); } ... Add solution -
Javascript 2021-09-11 07:06:02
resolve vs return promise js
In simple terms, inside a then handler function: A) When x is a value (number, string, etc): - return x is equivalent to return Promise.resolve(x) - throw x is equivalent to return Promise.reject(x) B) When x is a Promise that is already settled (not ... Add solution