UNPKG

1.45 kBMarkdownView Raw
1# 4sq
2
3A Node.JS wrapper for the [Foursquare API](https://developer.foursquare.com/overview/).
4
5How to use with JavaScript
6--------------------------
7
8```javascript
9var foursquare = require('4sq');
10
11var fsq = new foursquare({token: 'OAuth2 access_token'});
12
13fsq.checkins('self', {limit: 5}, function(error, data) {
14 if (error) {
15 throw new Error(error);
16 }
17
18 console.log(data);
19});
20```
21
22Or with CoffeeScript
23--------------------
24
25```coffeescript
26foursquare = require '4sq'
27
28fsq = new foursquare token: 'OAuth2 access_token'
29
30fsq.checkins 'self', limit: 5, (error, data) ->
31 throw new Error error if error
32 console.log data
33```
34
35----------------
36
37Install with NPM
38----------------
39
40 npm install 4sq
41
42How to retrieve Foursquare OAuth2 access_token
43----------------------------------------------
44
45Grab latest source code and install all dev dependencies
46
47 npm link
48
49Change your host, client id, client secret in [examples/get-access-token.coffee](http://github.com/meritt/node-4sq/blob/master/examples/get-access-token.coffee) and after that run [examples/get-access-token.coffee](http://github.com/meritt/node-4sq/blob/master/examples/get-access-token.coffee)
50
51 coffee examples/get-access-token.coffee
52
53API
54---
55
56* user (*user id*, *params*, *callback*)
57* checkins (*user id*, *params*, *callback*)
58* badges (*user id*, *params*, *callback*)
59
60Author
61------
62
63* [Alexey Simonenko](mailto:alexey@simonenko.su), [simonenko.su](http://simonenko.su)
\No newline at end of file