Tuesday, 24 December 2013

Hacking on MEAN stack

The Objective of this post is to get started with MEAN stack, where

M => mongodb
E  => expressjs
A  => angularjs
N  => nodejs

STEP 1 Install M(ongodb)
Mongodb is the a document database serving storage for MEAN stack.
To install it, please follow installation steps at Hacking on grails and mongodb

STEP 2 install N(odejs)
Node.js is a platform built on Chrome's JS runtime for easily building fast, scalable network apps.
To install it, please follow Hacking on node.js and geddy

STEP 3 Install E(xpressjs)
Express is a minimal and flexible node.js framework (for web application).
Assuming npm is installed, execute following command to install express.
$ npm install -g express

Seems it needs npm install express-generator -g to get express working in lates versions.

3.1 create express web app

$ express onlywallet

   create : onlywallet
   create : onlywallet/package.json
   create : onlywallet/app.js
   create : onlywallet/public
   create : onlywallet/public/images
   create : onlywallet/routes
   create : onlywallet/routes/index.js
   create : onlywallet/routes/user.js
   create : onlywallet/public/stylesheets
   create : onlywallet/public/stylesheets/style.css
   create : onlywallet/views
   create : onlywallet/views/layout.jade
   create : onlywallet/views/index.jade
   create : onlywallet/public/javascripts

   install dependencies:
     $ cd onlywallet && npm install

   run the app:
     $ node app

3.2 add mongodb driver and mongoosejs

"dependencies": {
  "express": "3.0.3",
  "jade": "*",
  "mongodb": ">= 0.9.6-7",
  "mongoose" : ">= 3.6"
}

3.3 configure app.js to connect to mongodb
var Mongoose = require('mongoose');
var db = Mongoose.createConnection('localhost', 'onlywallet');


STEP 4 install A(ngularjs) using Bower
AngularJS is for writing client-side web apps as if you had a smarter browser.

$ npm install bower –g
bower install angular#1.0.6

Just noticed http://mean.io, where MEAN comes as a single bundle within npm.

References
http://expressjs.com/guide.html

http://dandean.com/nodejs-npm-express-osx/

http://thecodebarbarian.wordpress.com/2013/07/22/introduction-to-the-mean-stack-part-one-setting-up-your-tools/

No comments:

Post a Comment