From 74e9e86e0dfdb31e866c9cb1a12063f9c474b322 Mon Sep 17 00:00:00 2001 From: Pau Ramon Date: Mon, 13 Dec 2010 23:55:53 +0100 Subject: [PATCH] Improved the test. Closes #1 --- Readme.md | 16 +++++++++------- package.json | 2 +- test/client.js | 8 ++------ test/{ => views}/client.jade | 0 test/{ => views}/done.jade | 0 test/views/layout.jade | 6 ++++++ 6 files changed, 18 insertions(+), 14 deletions(-) rename test/{ => views}/client.jade (100%) rename test/{ => views}/done.jade (100%) create mode 100644 test/views/layout.jade diff --git a/Readme.md b/Readme.md index b6732e5..12e7190 100644 --- a/Readme.md +++ b/Readme.md @@ -29,13 +29,13 @@ facebook-js has three methods. app.get('/', function (req, res) { res.redirect(facebookClient.getAuthorizeUrl({ client_id: 'appID', - redirect_uri: 'http://localhost:3003/auth', + redirect_uri: 'http://yourhost.com:3003/auth', scope: 'offline_access,publish_stream' })); }); app.get('/auth', function (req, res) { - facebookClient.getAccessToken({redirect_uri: 'http://localhost:3003/auth', code: req.param('code')}, function (error, token) { + facebookClient.getAccessToken({redirect_uri: 'http://yourhost.com:3003/auth', code: req.param('code')}, function (error, token) { res.render('client.jade', {locals: {token: token}}); }); }); @@ -55,8 +55,10 @@ facebook-js has three methods. To test and see this module working: - * clone this repo and open the test folder - * create a facebook app with the url pointing to http://localhost:3003/ - * set up the keys and password of your facebook app at client.js file - * run it! _node test/client.js_ - * Open your browser at localhost:3003 + * Install the module: `npm install facebook-js` + * Clone this repo and open the test folder + * Add a host to your hosts file `127.0.0.1 yourhost.com` + * Create a facebook app with the url pointing to http://yourhost.com:3003/ + * Set up the appID and the appSecret of your facebook app on the client.js file + * Run it! _node test/client.js_ + * Open your browser at yourhost.com:3003 diff --git a/package.json b/package.json index 9a6cc3e..efc33c5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "facebook-js", "description": "easy peasy facebook client", - "version": "0.0.3", + "version": "0.0.4", "author": "Pau Ramon ", "keywords": ["facebook"], "main" : "lib/facebook_client.js", diff --git a/test/client.js b/test/client.js index 5304487..44febce 100644 --- a/test/client.js +++ b/test/client.js @@ -1,7 +1,3 @@ -/** - * Module dependencies. - */ - var express = require('express'), connect = require('connect'), facebookClient = require('./../')( @@ -19,13 +15,13 @@ app.set('views', __dirname); app.get('/', function (req, res) { res.redirect(facebookClient.getAuthorizeUrl({ client_id: 'appID', - redirect_uri: 'http://localhost:3003/auth', + redirect_uri: 'http://yourhost.com:3003/auth', scope: 'offline_access,publish_stream' })); }); app.get('/auth', function (req, res) { - facebookClient.getAccessToken({redirect_uri: 'http://localhost:3003/auth', code: req.param('code')}, function (error, token) { + facebookClient.getAccessToken({redirect_uri: 'http://yourhost.com:3003/auth', code: req.param('code')}, function (error, token) { res.render('client.jade', { layout: false, locals: { diff --git a/test/client.jade b/test/views/client.jade similarity index 100% rename from test/client.jade rename to test/views/client.jade diff --git a/test/done.jade b/test/views/done.jade similarity index 100% rename from test/done.jade rename to test/views/done.jade diff --git a/test/views/layout.jade b/test/views/layout.jade new file mode 100644 index 0000000..2ec5584 --- /dev/null +++ b/test/views/layout.jade @@ -0,0 +1,6 @@ +!!! +html + head + title example + body + != body