Showing posts with label nodejs. Show all posts
Showing posts with label nodejs. Show all posts
Friday, June 8, 2012
Saturday, February 11, 2012
Using Colourlovers.com API with NodeJS
Colourlovers.com has a pretty good and straightforward API.
The following snippet fetches the top palettes with the help of NodeJS
The following snippet fetches the top palettes with the help of NodeJS
Saturday, May 21, 2011
req.body undefined in POST request in Express js
You have to use a bodyparser to process the body of a POST request
and put this before the routing definition, like this
here is the related google groups thread.
app.use(express.bodyParser());and put this before the routing definition, like this
app.configure('development', function() {
console.log("Development mode");
app.configure(function() {
app.use(express.bodyParser());
app.use(app.router);
.....
});
});
here is the related google groups thread.
Friday, April 15, 2011
Thursday, April 14, 2011
Reset Joyent Smartmachine Nodejs git repo
cd ~
rm -rf repo
mkdir repo
cd repo
git --bare init
cp /opt/nodejs/post-receive* hooks/
cd ~
Deleting the old repo, creating a new one and then copy the post-recieve hooks.
Monday, February 28, 2011
Supervisor for NodeJS
Supervisor runs your nodejs programs and restarts them when a *.js file changes
npm install supervisor
supervisor -p server.js -w .
This example runs server.js and watches the current folder, if a js file changes in this folder it restarts the server.js
Installing NodeJS from source on Snow Leopard
git clone https://github.com/joyent/node.git
cd node
mkdir ~/local
./configure --prefix=$HOME/local/node
make
make install
export PATH=$HOME/local/node/bin:$PATH
Now if you open a new terminal window
node --version
you should see the new version number.
Friday, February 4, 2011
Creating a NPM package
NPM is a package manager for node.
Creating packages with NPM is not difficult so here are the steps.
Here is an example
First, you have to create a user in the repo.
Then you can publishing the package
This is a good resource (Introduction to npm) but for some strange reason it was difficult to read, maybe the writing style.
Creating packages with NPM is not difficult so here are the steps.
1. Creating the package.json
Here is an example
{
"name": "packagename",
"version": "0.0.1",
"description": "Package description",
"main": "package.js",
"keywords": [
"foursquare",
"4sq"
],
"repository" : {
"type" : "git",
"url" : "https://yikulju@github.com/yikulju/Foursquare-on-node.git"
}
}2. Linking it with NPM
npm link3. Publishing the package
First, you have to create a user in the repo.
npm adduserThen you can publishing the package
npm publishThis is a good resource (Introduction to npm) but for some strange reason it was difficult to read, maybe the writing style.
Thursday, January 20, 2011
EJS default escaping
In EJS (Embedded JavaScript) escaping is a default behaviour.
This can easily mess up a couple of things (including JSON, HTML rendering), luckily you can turn it off by using
// escape by default
<%= VARIABLE_NAME %>
This can easily mess up a couple of things (including JSON, HTML rendering), luckily you can turn it off by using
// render out string
<%- VARIABLE_NAME %>
Subscribe to:
Posts (Atom)