a simple proxy helper to call and cache temboo choreos locally.
Special thanks to Stefan Landsbek @47nrd for node.js tips and tricks!
Install node.js for your OS.
Install Temboo-Proxy:
download, unzip or (git clone https://github.com/b-g/temboo-proxy.git) ... and then in terminal:
cd temboo-proxy
npm install
Now specify your temboo credentials in the config.js file:
- copy config-sample.js
- rename the file to config.js
- fill in your temboo app credentials e.g.
config.temboo.user_name = 'b-g';
- go to https://temboo.com/library/ and click together in wizzard the choreos you want to use
- use the provided example code (at the end of the online wizzard) to define your choreos in tembooChoreos.js. There are already a few pre-defined, use them as a template for new ones. It is usally just tweaking one or two lines of the temboo example code.
node server.js
Now you can call your choreos locally:
localhost/choreoFunctionName?q=Query
e.g. http://localhost:3000/twittersearch?q=Stuttgart
NB. Every new call is cached exaclty once in the database ...
note: #stuttgart becomes %23stuttgart http://meyerweb.com/eric/tools/dencoder/
- http://localhost:3000/twittersearch?q=Israel
- http://localhost:3000/twittersearch?q=@bndktgrs+%23stuttgart
- http://localhost:3000/twittertimeline?q=Koby_Barhad
Flickr
- http://localhost:3000/flickrsearchphotos?lat=31.5&lon=34.75
- http://localhost:3000/flickrsearchphotos?q=ruin
- http://localhost:3000/flickrsearchphotos?lat=31.5&lon=34.75&q=field
NY Times
You can get rid of the database by deleting the contents in the db
folder or via calling http://localhost:3000/db/reset
.
If you don't want to cache any recieved content from temboo, then just comment out the caching of the choreo in tembooChoreos.js
// cache.set(cacheKey, results.get_Response());
And last (for devs) you might want to install a utility like nodemon that will monitor for any changes in your source and automatically restart your server. Very handy.