I think what you want to do is:
var user = require('./user')(client)
This enables you to have client as a parameter in each function in your module
or as module scope variable like this:
module.exports = function(client){
...
}
Related Contents:
- Folder structure for a Node.js project
- NPM global install “cannot find module”
- npm install from Git in a specific version
- How to force tsc to ignore node_modules folder?
- How can I generate an ObjectId with mongoose?
- What do the return values of node.js process.memoryUsage() stand for?
- How to install nvm in docker?
- NPM modules won’t install globally without sudo
- npm install error – unable to get local issuer certificate
- E: Unable to locate package npm
- How can I get the path of a module I have loaded via require that is *not* mine (i.e. in some node_module)
- Having error “Module ‘name’ resolves to an untyped module at…” when writing custom TypeScript definition file
- How can I set an environmental variable in node.js?
- How to install a specific version of Node on Ubuntu?
- Difference Between app.use() and router.use() in Express
- How do I parse a HTML page with Node.js
- Using PassportJS, how does one pass additional form fields to the local authentication strategy?
- Why should I use Restify?
- Global Node modules not installing correctly. Command not found
- Node.js – inheriting from EventEmitter
- Uploading file using POST request in Node.js
- How can I get a list of callbacks in the Node work queue? (or, Why won’t Node exit?)
- What the scenario call fs.close is necessary
- Could someone explain what “process.argv” means in node.js please?
- Passing environment variables in npm-scripts
- Assigning a domain name to localhost for development environment
- Nested objects in mongoose schemas
- How do you query for a non-existent (null) attribute in DynamoDB
- How can I increase the maximum call stack size in Node.js
- Node.js “FATAL ERROR: JS Allocation failed – process out of memory” — possible to get a stack trace?
- How to debug a socket hang up error in NodeJS?
- Passing arguments to npm script in package.json [duplicate]
- Can I get node –inspect to open Chrome automatically
- Node.js with Express – throw Error vs next(error)
- JavaScript wait for asynchronous function in if statement [duplicate]
- Install npm (Node.js Package Manager) on Windows (w/o using Node.js MSI)
- How do I access a server on localhost with nginx docker container?
- How to use AngularJS routes with Express (Node.js) when a new page is requested?
- Deploying Firebase App with Service Account to Heroku (environment variables with dotenv)
- Sharing & modifying a variable between multiple files node.js
- NodeJs execute command in background and forget
- What encodings does Buffer.toString() support?
- How to specify registry while doing npm install with git remote url?
- Warning on Connecting to MongoDB with a Node server
- Webpack –watch and launching nodemon?
- How should I organize multiple Express servers on the same system?
- Node.js www – non www redirection
- Can the pm2 node module restarts the app after crash automatically
- How can I use LEFT JOIN with Sequelize?
- Using require without export