Showing posts from June, 2013

Check if Mongoose it's already conected

You can tell if mongoose is already connected or not by simply checking: if(mongoose . connection . readyState){ } 0 = no 1 = yes

Error ! [rejected] master -> master (non-fast-forward) on Heroku/Git

$ git push origin master # To user / repo .git # ! [rejected] master -> master (non-fast-forward) # error: failed to push some refs to ' user / repo .git' # To prevent you from losing history, non-fast-forward updates were rejected # Merge the remote changes (e.g. 'git pull') before pushing again. See the # 'Note about fast-forwards' section of 'git push --help' for details. This error can be a bit overwhelming at first, do not fear.  Simply put, git push -f https//   to force the upload.

Mini Tutorial Node.js, Express, and Jade.

I was having some problems deploying some jade web pages over Node.js with Jade template engine. So I'm leaving a small tutorial for not forgetting what i have done so far... Let's see first install everything we need: >npm install express >npm install jade Now we have the pieces lest make the directory structure for this project, just add the directories "views" and "public" we will save the static things in public, like JavaScript and CSS files and jade views in views. Pretty obvious right... Now lets write some server code... var app = express(); app.configure(function(){ app.set('port', process.env.PORT || 3000); //set the port app.set('views', __dirname + '/views'); //set views dir app.set('view engine', 'jade'); // set the template engine a pp.use(express.favicon()); //set the favicon app.use(express.static(path.join(__dirname, 'public