1. .env file:
    2. DB_HOST=localhost
    3. DB_USER=root
    4. DB_PASS=s1mpl3
    5. require('dotenv').config();
    6. const db = require('db');
    7. db.connect({
    8. host: process.env.DB_HOST,
    9. username: process.env.DB_USER,
    10. password: process.env.DB_PASS
    11. });
    12. cross-env
    13. {
    14. "scripts": {
    15. "start-prod": "cross-env NODE_ENV=production node ./app.js"
    16. }
    17. }
    18. debug
    19. const debug = require('debug')('http')
    20. , http = require('http')
    21. , name = 'My App';
    22. debug('booting %o', name);
    23. http.createServer(function(req, res){
    24. debug(req.method + ' ' + req.url);
    25. res.end('hello\n');
    26. }).listen(3000, function(){
    27. debug('listening');
    28. });