0
node.js and ql.ioBuild Your Own July 20, 2012 for         OSCON HTTP APIs                                   1
SubbuAllamaraju@sallamargithub.com/s3u           2
JonLeBlanc@jcleblancgithub.com/jcleblanc             3
How to consumeHTTP APIscheaply and              4
curl -X <HTTP method> <URI>                              5
Real code(randomized)
7
8
9
10
11
12
13
14
Use case:Find things from AFor each thing, find details fromFor each thing, find more detaMerge results                   ...
Use case:Find productsFind dominant categories of prLook up category infoMerge categories with product                    ...
Use case:Get stuff from AIf A is down, try from BAnnotate stuff with other stuff fIgnore some things from the stJoin all  ...
Client         [Really important client]         Why dont you give me an         API optimized for my use                 ...
Client         [Really important client]         Why dont you give me an         API optimized for my use                 ...
Build Your OwnOptimized APIs                 20
https://github.com/ql        -io/ql.io      Platform Engineering                         21
A domain specificlanguage for HTTPclient programming                     22
cut down lines of codereduce no of requests    save bandwidth                         23
24
http://ql.io/console                       25
ql.io Installation ModesWeb       Server      Node.js                             26
curl http://<host>/q?s=query                               27
As a Standalone Server  Data(internal    )         ql.io     Node Host  Data(externa    l)
# As a node.js modulenpm install ql.io-engine
// Use ql.io from node.jsvar Engine = require(ql.io-engine);var engine = new Engine({   //OPTIONS});var script = …;engine....
Language: Defining a Data SourceInclude in Request   Include in .ql file
Example: Mustache Templates
Example: jQuery for Cross Domain Reqs
Let’s Do It!
1. Interop via   HTTP2. SQL inspired3. Implicit   orchestration4. Failure modes   35
code  https://github.com/ql-io/ql.iodocs/demos http://ql.io https://github.com/jcleblanc/api-masherblog  http://ql-io.gith...
Upcoming SlideShare
Loading in...5
×

OSCON 2012: ql.io and Node.js

986

Published on

OSCON 2012 (July - Portland, OR) presentation by Subbu Allamaraju and myself on ql.io and Node.js

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
986
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • If you download the standalone server version of ql.io, it will sit on top of your existing node server (or within your node applications) and be able to query your internal data and/or external data sources
  • 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.
  • First we need some mustache power
  • Route files are also stored with the .ql extension but are placed under the routes directory
  • create table slideshare on select get from &quot;http://www.slideshare.net/rss/user/{user}&quot; resultset &quot;rss.channel&quot;;create table github.users on select get from &quot;http://github.com/api/v2/json/user/show/{user}&quot;;user = &quot;jcleblanc&quot;;slides = select * from slideshare where user=&quot;{user}&quot;;twitter = select * from github.users where user=&quot;{user}&quot;;return { &quot;slides&quot;: &quot;{slides}&quot;, &quot;twitter&quot;: &quot;{twitter}&quot;}
  • Transcript of "OSCON 2012: ql.io and Node.js"

    1. 1. node.js and ql.ioBuild Your Own July 20, 2012 for OSCON HTTP APIs 1
    2. 2. SubbuAllamaraju@sallamargithub.com/s3u 2
    3. 3. JonLeBlanc@jcleblancgithub.com/jcleblanc 3
    4. 4. How to consumeHTTP APIscheaply and 4
    5. 5. curl -X <HTTP method> <URI> 5
    6. 6. Real code(randomized)
    7. 7. 7
    8. 8. 8
    9. 9. 9
    10. 10. 10
    11. 11. 11
    12. 12. 12
    13. 13. 13
    14. 14. 14
    15. 15. Use case:Find things from AFor each thing, find details fromFor each thing, find more detaMerge results 15
    16. 16. Use case:Find productsFind dominant categories of prLook up category infoMerge categories with product 16
    17. 17. Use case:Get stuff from AIf A is down, try from BAnnotate stuff with other stuff fIgnore some things from the stJoin all 17
    18. 18. Client [Really important client] Why dont you give me an API optimized for my use Producers cases? Server [Really important producer] Thanks. Get a number and stand in the line! 18
    19. 19. Client [Really important client] Why dont you give me an API optimized for my use Producers cases? Who gets to decide the right Server thing? [Really important producer] Thanks. Get a number and stand in the line! 19
    20. 20. Build Your OwnOptimized APIs 20
    21. 21. https://github.com/ql -io/ql.io Platform Engineering 21
    22. 22. A domain specificlanguage for HTTPclient programming 22
    23. 23. cut down lines of codereduce no of requests save bandwidth 23
    24. 24. 24
    25. 25. http://ql.io/console 25
    26. 26. ql.io Installation ModesWeb Server Node.js 26
    27. 27. curl http://<host>/q?s=query 27
    28. 28. As a Standalone Server Data(internal ) ql.io Node Host Data(externa l)
    29. 29. # As a node.js modulenpm install ql.io-engine
    30. 30. // Use ql.io from node.jsvar Engine = require(ql.io-engine);var engine = new Engine({ //OPTIONS});var script = …;engine.execute(script, function(emitter){ emitter.on("end", function(err, res){ … });});
    31. 31. Language: Defining a Data SourceInclude in Request Include in .ql file
    32. 32. Example: Mustache Templates
    33. 33. Example: jQuery for Cross Domain Reqs
    34. 34. Let’s Do It!
    35. 35. 1. Interop via HTTP2. SQL inspired3. Implicit orchestration4. Failure modes 35
    36. 36. code https://github.com/ql-io/ql.iodocs/demos http://ql.io https://github.com/jcleblanc/api-masherblog http://ql-io.github.com 36
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×