From 624b2bbe66bd0735ad078caffa63bbfebe6bbb80 Mon Sep 17 00:00:00 2001 From: "David W. McKelvey" Date: Wed, 16 Mar 2011 22:27:08 -0700 Subject: [PATCH 1/2] updates for version bump and syntax changes for node 0.4.2 and updates to the readme --- README | 50 ++++++++++++++++++++++++++++++++--------------- settings.js | 4 ++-- views/layout.jade | 6 +++--- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/README b/README index 29681df..ee16df1 100644 --- a/README +++ b/README @@ -9,51 +9,68 @@ INSTAGRAM SERVERS CAN POST TO YOUR CALLBACK URL. RUNNING IT LOCALLY WON'T WORK WITHOUT USING SOMETHING LIKE LOCALTUNNEL TO EXPOSE A PORT: https://github.com/progrium/localtunnel/ +1) Install Needed Resources (this is for debian, adapt as necessary for others) -1) Install Node.js +sudo apt-get install g++ curl libssl-dev apache2-utils git-core -curl -O http://nodejs.org/dist/node-v0.4.1.tar.gz -tar xvf node-v0.4.1.tar.gz -./configure -sudo make && sudo make install +2) Install Node.js -2) Install Redis +curl -O http://nodejs.org/dist/node-v0.4.2.tar.gz +tar xvf node-v0.4.2.tar.gz +cd node-v0.4.2 + +or: + +git clone git://github.com/joyent/node.git +cd node + +then: -curl -O http://redis.googlecode.com/files/redis-2.2.1.tar.gz -tar xvf redis-2.2.1.tar.giz ./configure sudo make && sudo make install -3) Run Redis +3) Install Redis -redis-server conf/redis.conf +curl -O http://redis.googlecode.com/files/redis-2.2.2.tar.gz +tar xvf redis-2.2.2.tar.giz +cd redis-2.2.2 +sudo make && sudo make install -3) Install NPM (Node package manager) +4) Install NPM (Node package manager) curl http://npmjs.org/install.sh | sh or: -git clone http://github.com/isaacs/npm.git +git clone git://github.com/isaacs/npm.git cd npm sudo make install -4) Install required node libraries +5) Install Required Node Libraries sudo npm install redis sudo npm install socket.io sudo npm install express sudo npm install jade -5) Add your client_id and client_secret to settings.js +6) Install this Demo App + +git clone git://github.com/Instagram/Realtime-Demo.git +cd Realtime-Demo -6) Run the server +7) Run Redis from the Demo App + +redis-server conf/redis.conf + +8) Add your client_id and client_secret to settings.js + +9) Run the Server node server.js Navigate to http://your-server:3000/ and you should see a blank page. -7) Create a geography subscription. Here's sample code for Las Vegas: +10) Create a Geography Subscription. Here's sample code for Las Vegas: curl -F 'client_id=YOUR-CLIENT-ID' \ -F 'client_secret=YOUR-CLIENT-SECRET' \ @@ -65,6 +82,7 @@ curl -F 'client_id=YOUR-CLIENT-ID' \ -F 'callback_url=http://your-server:3000/callbacks/geo/las-vegas/' \ https://api.instagram.com/v1/subscriptions/ + Make sure to replace client_id and client_secret with your own. Also, it's not required to run your server at port 3000, but that's the standard node port ;) If you're lucky, someone will take a photo in Las Vegas, and it will pop up on your screen at the same moment they post the photo. diff --git a/settings.js b/settings.js index d421870..a98058c 100644 --- a/settings.js +++ b/settings.js @@ -17,9 +17,9 @@ app.set('view engine', 'jade'); app.configure(function(){ app.use(express.methodOverride()); - app.use(express.bodyDecoder()); + app.use(express.bodyParser()); app.use(app.router); - app.use(express.staticProvider(__dirname + '/public/')); + app.use(express.static(__dirname + '/public/')); }); app.configure('development', function(){ app.use(express.logger()); diff --git a/views/layout.jade b/views/layout.jade index a5a0413..3092436 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -7,9 +7,9 @@ html script(src="/socket.io/socket.io.js", type="text/javascript") script(src="/static/scripts/jquery-1.5.min.js", type="text/javascript") script(src="/static/scripts/master.js", type="text/javascript") - :javascript - | socket.connect(); - | $(document).ready(Media.positionAll); + script(type="text/javascript") + socket.connect(); + $(document).ready(Media.positionAll); body #wrap !{body} \ No newline at end of file From 5f40b87fad51fddd44b2a881ffd9bda0240d2aa2 Mon Sep 17 00:00:00 2001 From: "David W. McKelvey" Date: Wed, 16 Mar 2011 22:34:45 -0700 Subject: [PATCH 2/2] one more syntax change --- views/geo.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/geo.jade b/views/geo.jade index 9fd62dc..4bb3edf 100644 --- a/views/geo.jade +++ b/views/geo.jade @@ -1,7 +1,7 @@ h1 img(src="/static/images/logo.png") div#wrapper - != partial('image', images) + != partial('./partials/image', images) .cols .col-1 h2 What is this page?