Need small help I wrote a program and uploaded to the github repo. So I can use this repo as a npm package
So I fetch the repo as npm package in my other program
my package.json look like this
"dependencies":{
"admin-server":"github:esrot-server/admin-server#main"
}
but the problem is I want to pass one parameter to github repo from my other program so I wrote code like this in my github admin-server
index.js
// all the code here
const admin_task =(server_detail) =>{
// all the other code here
}
module.exports = admin_task(server_detail);
and in my other repo I am writing the code like this
client-side repo (other program) index.js
const admin_setup = require("admin-server");
// all the code here
const adminFunction = ()=>{
// all the other code
admin_setup(adminDetails);
}
so When I run the program I am getting server_detail
is not define but I have define this in my github repo.
I just wanted to know how can I pass my detail from client server to admin server which is in github repo and how can I tackle this problem
CodePudding user response:
You are exporting it wrong. Simply export the function. don't call it:
module.exports = admin_task;