Goal
====

I'm new to node and I'm trying to write a code in a way where I don't have to keep track of exporting everysingle functions that I've wrote in that file.

---

Steps
=====

I have a function

*general.js*

```
import request from 'request-promise'
import env from 'dotenv'
const dotenv = env.config();

function getInfo(req, res)
{
    var $mac    = req.body.mac;
    return new Promise((resolve, reject) => {
        request({ uri: `${process.env.API_HOST}/${$mac}` })
            .then((cpe) => resolve(JSON.parse(cpe).data))
            .catch((error) => reject(error));
    });

}

module.exports = {
    getInfo
};

```

How would I adjust it so that my functions are export automatically ?

---

I've tried

```
import request from 'request-promise'
import env from 'dotenv'
const dotenv = env.config();

module.exports = () => {
    let general = {};

    general.getInfo = ($mac) => {
        return new Promise((resolve, reject) => {
            request({ uri: `${process.env.API_HOST}/${$mac}` })
                .then((count) => resolve(JSON.parse(count).data))
                .catch((error) => reject(error));
        });
    }
    return general;
}

```

I kept getting

> 
> Error: Route.post() requires a callback function but got a [object Undefined]
> 
> 
> 

How can I debug this further?