Working with npm modules

You can use any npm module by installing it from the command line using npm install. NodeChef does not upload your local node_modules folder to the server but rather generates a package,json and then build the modules incrementally on the server. The first time you push code might take a while as all your modules have to be built on the server.

-cloud/ node_modules/ twilio/ main.js app.js


Example installing the module twilio. CD into your cloud folder and from the terminal or command prompt use the command "npm install twilio" to add this module to your project. The twilio module will be created as a sub folder under the folder node_modules. Npm automatically creates the node_modules folder on your behalf.

From the main.js module you can require twilio by using require('./node_modules/twilio') or require('twilio'). Reference the Node.js Modules guide for a complete overview.