High Performance API Mashups with Node.js and ql.io

2,884 views
2,624 views

Published on

High Performance API Mashups

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
  • wow ossume keynote :) thanks for the share
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,884
On SlideShare
0
From Embeds
0
Number of Embeds
107
Actions
Shares
0
Downloads
29
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide
  • Mashing up multiple data sourcesPerformance issues
  • Language based on a SQL-like syntax which exports all data to JSON
  • A create table call (to define a data source) may be included in the HTTP request to the ql.io web source or defined in a .ql file, which is added into the /tables directory of your application.
  • create table slideshare on select get from "http://www.slideshare.net/rss/user/{user}" resultset "rss.channel";create table github on select get from "https://api.github.com/users/{user}";user = "jcleblanc";slides = select * from slideshare where user="{user}";person = select * from github where user="{user}";return { "slides": "{slides}", "person": "{person}"}
  • Route files are also stored with the .ql extension but are placed under the routes directory
  • First we need some mustache power
  • Route files are also stored with the .ql extension but are placed under the routes directory
  • -- http://api.hunch.com/api/v1/get-recommendations/?user_id=tw_jcleblanc&topic_id=cat_electronics&limit=5create table hunch on select get from "http://api.hunch.com/api/v1/get-recommendations/?user_id={uid}&topic_ids={tid}&limit={limit}" using defaults limit="20" resultset "recommendations";--select title from hunch where uid="tw_jcleblanc" and tid="cat_electronics";select * from finditems where keywords in (select title from hunch where uid="tw_jcleblanc" and tid="cat_electronics");
  • High Performance API Mashups with Node.js and ql.io

    1. 1. High Performance Mashups Using ql.io and Node.js Jonathan LeBlanc Developer Evangelist (PayPal) Twitter: @jcleblanc | @PayPalDev Github: github.com/jcleblanc
    2. 2. ql.io: The Problem is API Overload
    3. 3. ql.io: Reducing Workload + Processing Reduced Documentation Reduced Code Length Reduced Result Syncing
    4. 4. ql.io: Increasing Performance (Requests)
    5. 5. ql.io: Error Handling and Reporting
    6. 6. ql.io: Open Standard Foundation
    7. 7. ql.io: Using the System Standalone Server / Web Endpoint Node.js App
    8. 8. Language: Defining a Data Source Include in Request Include in .ql Table
    9. 9. ql.io: The Test Console Test Console: http://ql.io/console
    10. 10. Language: Including Script Routes user = "jcleblanc"; slides = select * from slideshare where user="{user}"; twitter = select * from github.users where user="{user}"; return { "slides": "{slides}", "twitter": "{twitter}" } via route /social using method post;
    11. 11. Language: Using Script Routescurl --header "content-type: application/x-www-form-urlencoded" -d "user=jcleblanc" http://localhost:3000/social
    12. 12. Example: Mustache Templates
    13. 13. Example: jQuery for Cross Domain Reqs
    14. 14. Let’s Do It!
    15. 15. Tools: API Masher Visualization Engine: https://github.com/jcleblanc/api-masher Technology Backbone – ql.io – jQuery – Mustache Templates
    16. 16. Node.js: Installing the Package npm install ql.io-engine
    17. 17. Node.js: Including the Engine var Engine = require(ql.io-engine); var engine = new Engine({ … });
    18. 18. Node.js: Invoking the Engine var script = "select * from …"; engine.execute(script, function(emitter){ emitter.on("end", function(err, res){ console.log(res[body][0]); }); });
    19. 19. Tools: External API Tables Tables Source: https://github.com/jcleblanc/ql.io-tables https://github.com/ql-io/ql.io- site/tree/master/tables
    20. 20. Thank You! Any Questions? http://www.slideshare.net/jcleblanc Jonathan LeBlanc Developer Evangelist (PayPal) Twitter: @jcleblanc | @PayPalDev Github: github.com/jcleblanc

    ×