Monday 23 July 2018

Best Practice: Where do I store global objects in Node.js apps?

If I'm building an app in Node.js and I need to use the AWS node module, for example.var AWS = require('aws-sdk');var uuid = require('node-uuid');var s3 = new AWS.S3();If I initialise that object with my user credentials where would I store that object so my other files can access the object?Do I add the object initialisation code to the root index.js file and module.export the object or do I add it into a separate file like s3.js?

Submitted July 23, 2018 at 03:17PM by anthonybudd

No comments:

Post a Comment