8/23/2017 - 6:33 PM

setup express and mongo and heroku in cloud9

setup express and mongo and heroku in cloud9

$ sudo apt-get install nodejs
$ npm install express-generator -g
$ express . --ejs   // jade or ejs or hbs etc...
$ npm install
  • in ./bin/www change change var debug = require('debug')(workspace:server) to var debug = require('debug')(main)

  • In c9 set a run configuration for bin/www and set an evironment variable for `DEBUG=main' and make sure the configuration runs with nodejs

  • remove the favicon require module from app.js

$ git init
$ git add .
$ git commit -am "init"
$ heroku login
$ heroku git:remote -a name-of-the-app
$ git push -u heroku master
$ heroku addons:add mongolab
$ heroku config:set NODE_ENV=production
$ mkdir data &&
$ alias mng='mongod --nojournal --dbpath=data'
$ npm rm serve-favicon --save
  • use heroku logs -n 1500 to see heroku loggings
  • use the 'mng' alias to run mongo