How to store Node.js deployment settings/configuration files?

I use a package.json for my packages and a config.js for my configuration, which looks like: var config = {}; config.twitter = {}; config.redis = {}; config.web = {}; config.default_stuff = [‘red’,’green’,’blue’,’apple’,’yellow’,’orange’,’politics’]; config.twitter.user_name = process.env.TWITTER_USER || ‘username’; config.twitter.password= process.env.TWITTER_PASSWORD || ‘password’; config.redis.uri = process.env.DUOSTACK_DB_REDIS; config.redis.host=”hostname”; config.redis.port = 6379; config.web.port = process.env.WEB_PORT || 9980; module.exports = … Read more

How to process POST data in Node.js?

You can use the querystring module: var qs = require(‘querystring’); function (request, response) { if (request.method == ‘POST’) { var body = ”; request.on(‘data’, function (data) { body += data; // Too much POST data, kill the connection! // 1e6 === 1 * Math.pow(10, 6) === 1 * 1000000 ~~~ 1MB if (body.length > 1e6) … Read more

How do I update Node.js?

I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac. Clear NPM’s cache: sudo npm cache clean -f Install a little helper called ‘n’ sudo npm install -g n Install latest stable Node.js version sudo n stable Alternatively pick a specific version and install like this: sudo n 0.8.20 … Read more

How do you prevent install of “devDependencies” NPM modules for Node.js (package.json)?

The npm install command will install the devDependencies along other dependencies when run inside a package directory, in a development environment (the default). In version 8.x and above use –omit=dev flag to install only regular dependencies: npm install –omit=dev This will install only dependencies, and not devDependencies, regardless of the value of the NODE_ENV environment … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)