This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var cluster = require('cluster'); | |
| var http = require('http'); | |
| var numCPUs = require('os').cpus().length; | |
| if (cluster.isMaster) { | |
| // Fork workers. | |
| for (var i = 0; i < numCPUs; i++) { | |
| cluster.fork(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // from Horofox in #node.js | |
| var mongoose = require('mongoose'); | |
| var db = mongoose.connect('mongodb://localhost/mydb'); | |
| function allowPosts(mongoose) { | |
| var Schema = mongoose.Schema; | |
| var Posts = new Schema({ | |
| name : String, | |
| subject: String, | |
| comment : String, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Steps | |
| pkgin install couchdb | |
| svccfg import /opt/local/share/smf/manifest/couchdb.xml | |
| svcadm enable couchdb | |
| #Test | |
| curl http://127.0.0.1:5984/ | |
| {"couchdb":"Welcome","version":"1.0.1"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NUMBER_OF_CPU_CORES=2 | |
| BASHRC=~/.bashrc # use .bash_profile on OS X | |
| # Remove old Node.JS installation | |
| rm ~/local/*/node* -rf | |
| rm ~/.node_libraries -rf | |
| sudo rm /usr/local/*/node* -rf | |
| sudo rm /usr/*/node* -rf | |