MCPcopy
hub / github.com/serverless/examples / dbConnectAndExecute

Function dbConnectAndExecute

aws-node-rest-api-mongodb/handler.js:18–20  ·  view source on GitHub ↗
(dbUrl, fn)

Source from the content-addressed store, hash-verified

16const dbExecute = (db, fn) => db.then(fn).finally(() => db.close());
17
18function dbConnectAndExecute(dbUrl, fn) {
19 return dbExecute(mongoose.connect(dbUrl, { useMongoClient: true }), fn);
20}
21
22module.exports.user = (event, context, callback) => {
23 if (!validator.isAlphanumeric(event.pathParameters.id)) {

Callers 1

handler.jsFile · 0.70

Calls 1

dbExecuteFunction · 0.70

Tested by

no test coverage detected