13 thoughts on “Importing and exporting modules with Node.js

  1. Dude, you saved my life tonight. The code I inherited was using some complex module patterns and I needed something simple like your example to get back to a baseline, troubleshoot why I couldn't export my effing module. Works like a charm now. I should have searched for this a few hours ago!

  2. I have a question it's regarding exports but not involve in your video, what is register?
    (exports.register) also the only register in the whole code is "var registerEventHandlers = function (eventHandlers, skillContext) "

  3. Im trying to return values using export
    But, the console shows undefined

    This is my code

    playicon.js
    module.exports = function sendvalues(val1, val2){
    return val1;
    return val2;
    console.log(val1);
    };

    database.js
    var sqlite3 = require('sqlite3').verbose();
    var playicon = require('./playicon');
    console.log(playicon); //returning function
    console.log(playicon.sendvalues()); returns undefined

    I need to return val1, val2 in above function.
    Please help!

Leave a Reply

Your email address will not be published. Required fields are marked *