In this introduction to node, I will be using ExpressJS. If you have not already done so, install NPM and then as root, "npm install express".
On my dev platform, I create a new Express Project:
express -s madisonHQ
This command creates a new folder "madisonHQ" and adds a skel app.js. Head to git and create a new repository.
Now, lets get this setup on Git.
cd madisonHQ
git remote add madisonHQ git@github.com:mikekunze/madisonHQ.git
git init
git add .
git commit -m 'first commit'
git push -u madisonHQ master
As you can see here, https://github.com/mikekunze/madisonHQ, my new project is synced and repo'ed.
Depending on your environment, you might need to get the express library added to the project. This is easy. Inside the madisonHQ directory:
npm install express
Friday, August 19, 2011
Wednesday, August 17, 2011
MongoDB relational query and data customization
Lets talk about roles. Roles, for my implementation, represents an application container. An account may be granted a permission to this role, and run its applications.
For my relationalness, I always create a role permission collection, p_roles, that links references to the account identifier as well as the role identifier.
This is where my last example came in. This time, however, I want to populate a grid of accounts that do not exist in a role, so that the interface user may add them to it. This required two things:
For my relationalness, I always create a role permission collection, p_roles, that links references to the account identifier as well as the role identifier.
This is where my last example came in. This time, however, I want to populate a grid of accounts that do not exist in a role, so that the interface user may add them to it. This required two things:
- an array of account ids we want to exclude
- a 'not in' query
Sunday, August 14, 2011
MongoDB and Relational queries? Yes it can!
Hello internet, today I would like to give a little information on a misconception with MongoDB. NoSQL explicitly denounces relational queries as a thing of the past, however it is necessary to normalize your data and keep it efficient and avoid having duplicate information.
For my discussion today, I will refer to vendors permissions, which was for a sample purchasing app I demoed inside portalstack.
To do a relational look up, you need to do a bit of async programming. For me, I used the async library provided by the nodejs community.
First, I query my permissions collection, p_vendors, for an account_id and the vendor_id, both are ObjectID references.
Next, I use async to foreach the returned permission set. When the async call is complete, it returns the prepared data to ExpressJS and its sent off to the client.
For my discussion today, I will refer to vendors permissions, which was for a sample purchasing app I demoed inside portalstack.
To do a relational look up, you need to do a bit of async programming. For me, I used the async library provided by the nodejs community.
First, I query my permissions collection, p_vendors, for an account_id and the vendor_id, both are ObjectID references.
Next, I use async to foreach the returned permission set. When the async call is complete, it returns the prepared data to ExpressJS and its sent off to the client.
Saturday, August 13, 2011
Videos and Presentations
Today, I spent the morning watching a few conference videos discussing nodejs.
http://www.readwriteweb.com/hack/2011/07/nodejs-creator-ryan-dahls-keyn.php
http://joyeur.com/2011/08/11/node-js-meetup-distributed-web-architectures/
http://www.readwriteweb.com/hack/2011/07/nodejs-creator-ryan-dahls-keyn.php
http://joyeur.com/2011/08/11/node-js-meetup-distributed-web-architectures/
Thursday, August 11, 2011
Installing NodeJS and NPM
I will be installing NodeJS 4.1.0 on ubuntu 11.04.
Requirements
Get the archive
wget http://nodejs.org/dist/node-v0.4.10.tar.gz
Unpack the archive
tar zxvf node-v0.4.10.tar.gz ; cd node-v0.4.10/
Configure the compiler and install
sudo ./configure && sudo make && sudo make install
Finally, install NPM. This you must do as root, otherwise it gets messy
sudo su -
curl http://npmjs.org/install.sh | sh
Requirements
- sudo apt-get install open-ssl libssl-dev
Get the archive
wget http://nodejs.org/dist/node-v0.4.10.tar.gz
Unpack the archive
tar zxvf node-v0.4.10.tar.gz ; cd node-v0.4.10/
Configure the compiler and install
sudo ./configure && sudo make && sudo make install
Finally, install NPM. This you must do as root, otherwise it gets messy
sudo su -
curl http://npmjs.org/install.sh | sh
Subscribe to:
Posts (Atom)