0

It might be a simple but unable to crack it. started learning node.js. i want to use password-manager.js file in test.js. how can i do this.

**

My Directory structure:-
    root
        -home 
           - node-basics
               - node-password
                   - password-manager.js
               -node-mongo-connection
                   -test.js

**

//In password-manager.js
module.exports = function(){
//code.......

}



//I tried to module.exports
// test.js
var pm = require('/../../password-manager.js');
//but not sure doing it correctly or its a correct  method or not.
2
  • Try require('../node-password/password-manager') Commented Jun 21, 2018 at 6:07
  • @vibhor1997a thanks Commented Jun 21, 2018 at 6:17

1 Answer 1

1

Your relative path to password-manager.js is wrong.

Use this:

 var pm = require('../node-password/password-manager');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.