Skip to content

Commit

Permalink
Improved the test. Closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
masylum committed Dec 13, 2010
1 parent 42f8f81 commit 74e9e86
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
16 changes: 9 additions & 7 deletions Readme.md
Expand Up @@ -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}});
});
});
Expand All @@ -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
2 changes: 1 addition & 1 deletion 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 <masylum@gmail.com>",
"keywords": ["facebook"],
"main" : "lib/facebook_client.js",
Expand Down
8 changes: 2 additions & 6 deletions test/client.js
@@ -1,7 +1,3 @@
/**
* Module dependencies.
*/

var express = require('express'),
connect = require('connect'),
facebookClient = require('./../')(
Expand All @@ -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: {
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions test/views/layout.jade
@@ -0,0 +1,6 @@
!!!
html
head
title example
body
!= body

0 comments on commit 74e9e86

Please sign in to comment.