Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2012: ql.io and Node.js

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

2012: ql.io and Node.js

June 2012 presentation on ql.io and working with the system inside Node.js applications.

Jonathan LeBlanc

May 30, 2012

Transcript

40 slides
  1. ql.io  and  Node.js:  Next  Genera3on     Open  Source  Web

     Querying  System   Jonathan  LeBlanc   Developer  Evangelist:  X.commerce   Email:  [email protected]   Twi;er:  @jcleblanc   Github:  github.com/jcleblanc  
  2. Overview  of  ql.io   Language  SpecificaFons   Monkey  Patching  &

     Enhancements   IntegraFng  Into  Your  Node  ApplicaFons   Tools  and  More   Topics  We’ll  Be  Covering  
  3. Overview  of  ql.io   Language  SpecificaFons   Monkey  Patching  &

     Enhancements   IntegraFng  Into  Your  Node  ApplicaFons   Tools  and  More   Topics  We’ll  Be  Covering  
  4. ql.io:  Reducing  Workload  +  Processing     Reduced  DocumentaFon  

    Reduced  Code  Length   Reduced  Result  Syncing  
  5. ql.io:  Using  the  Standalone  Server   Node  Host   ql.io

      Data   (internal)   Data   (external)  
  6. Overview  of  ql.io   Language  Specifica3ons   Monkey  Patching  &

     Enhancements   IntegraFng  Into  Your  Node  ApplicaFons   Tools  and  More   Topics  We’ll  Be  Covering  
  7.   create  table  TABLE_NAME            

       on  select  get  from  "h;p://api.com/?val1={val1}"                using  defaults  val1="VALUE",                                                                    val2="VALUE”;       Language:  Create  Table  for  Data  Source  
  8.   create  table  github.issues            

       on  select  get  from  "h;ps://github.com/api/v2/json/                                                                                      issues/list/{user}/{repository}/                                                                                      {state}/"                using  defaults  state="open";     Language:  Sample  Github  Issues  Table  
  9.     select  *  from  TABLE_NAME        

           where  val1="VALUE"                and  val2="VALUE"              limit  10              offset  3;   Language:  Obtain  Data  From  New  Tables  
  10.   select  *  from  github.issues          

           where  user="jcleblanc"                  and  repository="reddit-­‐php-­‐sdk";     Language:  Sample  Github  Table  Call   {   "comments":  0,   "body":  "h;p://www.phpdoc.org/",   "Ftle":  "Use  standardized  documentaFon",   "updated_at":  "2011/12/11  13:49:07  -­‐0800",   "html_url":  "h;ps://github.com/jcleblanc/reddit-­‐php-­‐sdk/issues/3",   "state":  "open”   }  
  11.     insert  into  bitly.shorten  (longUrl)        

             values  ('h;p://ql.io/docs');   Language:  Insert  Request   "h;p://bit.ly/uZIvmY"  
  12. select  ItemID,  ViewItemURLForNaturalSearch,  LocaFon            

         from  details                  where  itemId                  in  (select  itemId                                              from  finditems                                              where  keywords='mini  cooper');   Language:  Nested  Selects   [   "330730216553",   "h;p://www.ebay.com/itm/Clubman-­‐Auto-­‐Sunroof-­‐Prem-­‐…",   "HunFngdon  Valley,  Pennsylvania"   ],  
  13. user  =  "jcleblanc";   slides  =  select  *  from  slideshare

     where  user="{user}";   twi;er  =  select  *  from  github.users  where  user="{user}";       return  {      "slides":  "{slides}",      "twi;er":  "{twi;er}"   }     via  route  '/social'  using  method  post;   Language:  Including  Script  Routes  
  14. curl  -­‐-­‐header  "content-­‐type:  applicaFon/x-­‐www-­‐form-­‐urlencoded"            -­‐d

     "user=jcleblanc"  h;p://localhost:3000/social   Language:  Using  Script  Routes  
  15. Overview  of  ql.io   Language  SpecificaFons   Monkey  Patching  &

     Enhancements   IntegraFng  Into  Your  Node  ApplicaFons   Tools  and  More   Topics  We’ll  Be  Covering  
  16.       create  table  TABLE_NAME        

           on  select  get  from  "h;p://api.com/?val1={val1}"                using  defaults  val1="VALUE"                using  patch  "patch.js";   Patching:  Including  the  Monkey  Patch  
  17.   exports['validate  param']  =  funcFon(args,  param,  value)  {    

               switch(param)  {                              case  'duraFon'  :                                            return  !isNaN(value  -­‐  0)                              default:                                            return  true;                }   }   Patching:  Valida3ng  Input  Parameters  
  18. exports['patch  body']  =  funcFon()  {          return

     {                  type:  'applicaFon/json',                  content:  JSON.stringify({message  :  'aok'})          };   }   Patching:  The  Body  Patch  
  19. exports['patch  response']  =  funcFon(args){            

       var  body  =  args.body;                    //modify  response  body                    return  body;   }   Patching:  The  Response  Patch  
  20. Overview  of  ql.io   Language  SpecificaFons   Monkey  Patching  &

     Enhancements   Integra3ng  Into  Your  Node  Applica3ons   Tools  and  More   Topics  We’ll  Be  Covering  
  21.   var  Engine  =  require('ql.io-­‐engine');   var  engine  =  new

     Engine({                                                        connecFon:  'close'                                                });       Node.js:  Including  the  Engine    
  22. Overview  of  ql.io   Language  SpecificaFons   Monkey  Patching  &

     Enhancements   IntegraFng  Into  Your  Node  ApplicaFons   Tools  and  More   Topics  We’ll  Be  Covering  
  23. Tools:  API  Masher   Visualiza3on  Engine:     h;ps://github.com/jcleblanc/api-­‐masher  

      Technology  Backbone   – ql.io   – jQuery   – Mustache  Templates    
  24. var  format  =  “<li><a  href=‘{{link}}’  target=‘_blank’>        

           <img  src=‘{{media:content.media:thumbnail.url}}’                  width=‘{{media:content.media:thumbnail.width}}’                  height=‘{{media:content.media:thumbnail.height}}’  /></a>                <br  /><span  class=‘small’>                <a  href=‘{{link}}’  target=‘_blank’>{{Ftle}}</a></span></li>”;   Tools:  API  Masher  
  25. var  query  =  “create  table  slideshare        

       on  select  get  from  ‘h;p://www.slideshare.net/rss/user/{user}’                  resultset  ‘rss.channel’;            select  *  from  slideshare  where  user=‘jcleblanc’”;     var  insertEl  =  “widgetContainer”;     parser.push(query,  format,  insertEl);   parser.render();   Tools:  API  Masher  
  26. Thank  You!   h;p://slidesha.re/ql-­‐io-­‐node   Jonathan  LeBlanc   Developer  Evangelist:

     X.commerce   Email:  [email protected]   Twi;er:  @jcleblanc   Github:  github.com/jcleblanc  

More Decks by Jonathan LeBlanc

Other Decks in Technology