Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

clean up

  • Loading branch information...
commit ad93b76df53e2b1d6e0d3cb387cbd374b7ccf238 1 parent b3f16b3
@smurthas authored
Showing with 19 additions and 13 deletions.
  1. +8 −5 README.md
  2. +8 −4 example/test.js
  3. +3 −4 package.json
View
13 README.md
@@ -1,9 +1,10 @@
# fitbit-js
-Simple FitBit API client for express + connect.
+Simple FitBit API client for express 3.
- npm install oauth express serializer
- npm install fitbit-js
+``` bash
+npm install fitbit-js
+```
## Usage
@@ -18,11 +19,13 @@ apiCall(http_method, path, params, callback) // Does a call to the FitBit API.
## Test
-Register an App with fitbit and either specify the callbackURI or append it to the command. NB: There may be some issues specifying 127.0.0.1 or localhost as the callbackURI.
+[Register an app with fitbit](https://dev.fitbit.com/apps/new) specifying a
+callback URL of `http://localhost:8553`.
```bash
+npm install
cd test
-node test.js [appkey] [appsecret] [callbackURI]
+node test.js [Consumer Key] [Consumer Secret]
```
open [http://localhost:8553](http://localhost:8553)
View
12 example/test.js
@@ -4,7 +4,10 @@ var app = express();
app.use(express.bodyParser());
app.use(express.cookieParser('sess'));
-var fitbitClient = require('../')(process.argv[2], process.argv[3], process.argv[4]);
+var PORT = process.argv[4] || 8553;
+
+var fitbitClient = require('../')(process.argv[2], process.argv[3],
+ 'http://localhost:' + PORT);
var token;
app.get('/', function (req, res) {
@@ -19,7 +22,8 @@ app.get('/', function (req, res) {
app.get('/getStuff', function (req, res) {
fitbitClient.apiCall('GET', '/user/-/activities/date/2011-05-25.json',
- {token: {oauth_token_secret: token.oauth_token_secret, oauth_token: token.oauth_token}},
+ {token: {oauth_token_secret: token.oauth_token_secret,
+ oauth_token: token.oauth_token}},
function(err, resp, json) {
if (err) return res.send(err, 500);
res.json(json);
@@ -31,5 +35,5 @@ app.get('/cookie', function(req, res) {
});
-app.listen(8553);
-console.log('listening at http://localhost:8553/');
+app.listen(PORT);
+console.log('listening at http://localhost:' + PORT + '/');
View
7 package.json
@@ -1,7 +1,7 @@
{
"name": "fitbit-js",
"description": "Simple FitBit API client",
- "version": "0.1.1",
+ "version": "0.2.0",
"author": "Simon Murtha Smith <simon@murtha-smith.com>",
"keywords": ["fitbit"],
"main" : "lib/fitbit_client.js",
@@ -10,9 +10,8 @@
"oauth": ">= 0.8.2",
"serializer": ">=0.0.2 <0.1.0"
},
- "devSpendencies": {
- "express":"",
- "connect":""
+ "devDependencies": {
+ "express":">= 3.0.0"
},
"repository" : {"type": "git" , "url": "http://github.com/smurthas/fitbit-js.git" },
"engines": { "node": ">=0.8.0 <0.9.0" }
Please sign in to comment.
Something went wrong with that request. Please try again.