.env file:
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
require('dotenv').config();
const db = require('db');
db.connect({
host: process.env.DB_HOST,
username: process.env.DB_USER,
password: process.env.DB_PASS
});
cross-env
{
"scripts": {
"start-prod": "cross-env NODE_ENV=production node ./app.js"
}
}
debug
const debug = require('debug')('http')
, http = require('http')
, name = 'My App';
debug('booting %o', name);
http.createServer(function(req, res){
debug(req.method + ' ' + req.url);
res.end('hello\n');
}).listen(3000, function(){
debug('listening');
});