# Customizing Module Installation

Besides auto-installing modules with dependencies and life cycle specified in`meta.js`, Robo Installer also gives you ability to customize installation of any particular module. To manually install a module, specify function`install`in its`meta.js`.

```javascript
// meta.js
module.exports = {
    install: function(container, name, path) {
        // your custom installation logic here.
    }
}
```

The function`install`accepts following parameters:

* **container**: The instance of Robo-Container used to bind module to.
* **name**: Name of the module recognized by the Module Installer, e.g 'config', 'config.development'.
* **path**: Path to the directory that contains the module.

*Once specified, only two options*`install`*and*`on`*will take effects and all other including*`use`*,*`set`*and*`singleton`*will be skipped.*

Let's say your`pricing`module has more than one payload files:`gateway.js`and`connector.js`and you want to install them all at once:

```
app
|- index.js
|- modules
|  |- pricing
|  |  |- meta.js
|  |  |- gateway.js
|  |  |- connector.js
```

Your installation will look like:

```javascript
// meta.js
module.exports = {
    install: function($, name, path) {
        $.bind(`${name}.connector`).to(`${path}/connector.js`); // $('pricing.connector') will return a connector.
        $.bind(name).to(`${path}/gateway.js`).use(`${name}.connector`); // $('pricing') will return a gateway.        
    }

    on: {
        installed: ($, name, path) => {
            // do some post-install checks here.
        }
    }
}
```

You can also use custom installation to install any`node_modules`to the container. For example:

```
app
|- index.js
|- modules
|  |- core
|  |  |- meta.js
```

Installation statements:

```javascript
// meta.js
module.exports = {
    install: function ($, name, path) {
        $.bind('express').to(() => require('express')).asSingleton();
        $.bind('app').to((express) => {
            var app = express();
            var bodyParser = require('body-parser');
            app.use(bodyParser.json());
            app.use(bodyParser.urlencoded({ extended: true }));
            return app;
        }).use('express').asSingleton();
        $.bind('http').to((app) => require('http').Server(app)).use('app').asSingleton();        
    }
}
```

`$('core')`*will throw an*`Error`*in this case as it's not bounded to container.*

*Do not install any utility library as module, e.g ImmutableJS. Otherwise you will make your application structure unnecessarily complex and you will also loose IDE intelli-sense supports as well.*
